object DMRel: TDMRel
  OldCreateOrder = False
  Height = 509
  Width = 740
  object dsRelat: TDataSource
    DataSet = QueryREnvioNCVComboio
    Left = 56
    Top = 96
  end
  object QueryRComboio: TZQuery
    Connection = DMprinc.ZConnection1
    AfterOpen = QueryRComboioAfterOpen
    SQL.Strings = (
      
        'select v.Placa, cidveiculo.nome ||'#39' - '#39'|| cidveiculo.uf as cidad' +
        'euf, cr.descricao as corveiculo, c.comboiocliente, merc.descrica' +
        'o as descmercadoria,'
      
        'v.anomod, tv.descricao as tipoveiculo , v.chassi, mar.descricao ' +
        '||'#39' / '#39'|| mod.descricao as marcamodelo,'
      
        'm.dataliberacao, m.nome as motorista, m.rg, m.cpf, m.validadecnh' +
        ' ||'#39' / '#39'|| m.cnh as cnhvalidade, m.celular, m.fone1,'
      
        'c.codcomboio, c.data ,c.kmprevisto, r.descricao as rastreador, r' +
        '.fixo, r.numero, clie.nome as cliente, clie.contato,'
      
        'cv.notafiscal, cv.valornf, cv.numeroctrc, cv.obs, v.limitepeso, ' +
        'carr.placa as carreta1, cv.mct, cv.codcomboioveiculo, cv.CONSULT' +
        'AMOTORISTA,'
      
        'carr.cidadeuf as cidadeufcarreta1, carr.cor as corcarreta1, carr' +
        '.ano as anocarr1, carr.tipo as tipocarreta1,'
      
        'ciddest.nome ||'#39' - '#39'|| ciddest.uf as cidadeufdest, cidor.nome ||' +
        #39' - '#39'|| cidor.uf as cidadeufor'
      
        'from mercadoria merc , comboioveiculo cv,comboio c , rastreador ' +
        'r, motorista m, cliente clie, cidade cidor, cidade ciddest,'
      
        'veiculo v left outer join tipoveiculo tv on (v.codtipoveiculo = ' +
        'tv.codtipoveiculo)'
      
        '          left outer join cidade cidveiculo on (cidveiculo.codci' +
        'dade = v.codcidade)'
      '          left outer join cor cr on (cr.codcor =  v.codcor)'
      
        '          left outer join modelo mod on(mod.codmodelo = v.codmod' +
        'elo)'
      
        '          left outer join marca mar on (mar.codmarca = v.codmarc' +
        'a)'
      
        '          left outer join carreta carr on (v.codcarreta1 = carr.' +
        'codveiculo)'
      
        'where c.codcomboio = cv.codcomboio and v.codveiculo = cv.codveic' +
        'ulo'
      
        'and m.codmotorista = cv.codmotorista and c.codcomboio = :pcodcom' +
        'boio'
      'and c.codcliente = clie.codcliente'
      'and c.codrastreador = r.codrastreador'
      '/*and cv.codrastreador = r.codrastreador*/'
      'and c.codorigem = cidor.codcidade'
      'and c.coddestino = ciddest.codcidade'
      'and cv.codmercadoria = merc.codmercadoria'
      'order by r.codrastreador desc')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodcomboio'
        ParamType = ptUnknown
      end>
    Left = 360
    Top = 160
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodcomboio'
        ParamType = ptUnknown
      end>
    object QueryRComboioPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRComboioCIDADEUF: TStringField
      FieldName = 'CIDADEUF'
      ReadOnly = True
      Required = True
      Size = 55
    end
    object QueryRComboioCORVEICULO: TStringField
      FieldName = 'CORVEICULO'
    end
    object QueryRComboioANOMOD: TSmallintField
      FieldName = 'ANOMOD'
    end
    object QueryRComboioTIPOVEICULO: TStringField
      FieldName = 'TIPOVEICULO'
      Size = 50
    end
    object QueryRComboioCHASSI: TStringField
      FieldName = 'CHASSI'
      Size = 50
    end
    object QueryRComboioMARCAMODELO: TStringField
      FieldName = 'MARCAMODELO'
      ReadOnly = True
      Required = True
      Size = 73
    end
    object QueryRComboioDATALIBERACAO: TDateField
      FieldName = 'DATALIBERACAO'
    end
    object QueryRComboioMOTORISTA: TStringField
      FieldName = 'MOTORISTA'
      Size = 50
    end
    object QueryRComboioRG: TStringField
      FieldName = 'RG'
    end
    object QueryRComboioCPF: TStringField
      FieldName = 'CPF'
    end
    object QueryRComboioCNHVALIDADE: TStringField
      FieldName = 'CNHVALIDADE'
      ReadOnly = True
      Size = 33
    end
    object QueryRComboioCELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRComboioFONE1: TStringField
      FieldName = 'FONE1'
      Size = 12
    end
    object QueryRComboioCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRComboioDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRComboioKMPREVISTO: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object QueryRComboioRASTREADOR: TStringField
      FieldName = 'RASTREADOR'
      Size = 50
    end
    object QueryRComboioFIXO: TSmallintField
      FieldName = 'FIXO'
    end
    object QueryRComboioNUMERO: TStringField
      FieldName = 'NUMERO'
    end
    object QueryRComboioCLIENTE: TStringField
      FieldName = 'CLIENTE'
      Required = True
      Size = 50
    end
    object QueryRComboioCONTATO: TStringField
      FieldName = 'CONTATO'
      Size = 50
    end
    object QueryRComboioNOTAFISCAL: TStringField
      FieldName = 'NOTAFISCAL'
      Size = 50
    end
    object QueryRComboioVALORNF: TFloatField
      FieldName = 'VALORNF'
    end
    object QueryRComboioNUMEROCTRC: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object QueryRComboioOBS: TStringField
      FieldName = 'OBS'
      Size = 100
    end
    object QueryRComboioLIMITEPESO: TIntegerField
      FieldName = 'LIMITEPESO'
    end
    object QueryRComboioCARRETA1: TStringField
      FieldName = 'CARRETA1'
      Size = 8
    end
    object QueryRComboioCIDADEUFCARRETA1: TStringField
      FieldName = 'CIDADEUFCARRETA1'
      Size = 55
    end
    object QueryRComboioCORCARRETA1: TStringField
      FieldName = 'CORCARRETA1'
    end
    object QueryRComboioANOCARR1: TSmallintField
      FieldName = 'ANOCARR1'
    end
    object QueryRComboioTIPOCARRETA1: TStringField
      FieldName = 'TIPOCARRETA1'
      Size = 50
    end
    object QueryRComboioCIDADEUFDEST: TStringField
      FieldName = 'CIDADEUFDEST'
      ReadOnly = True
      Required = True
      Size = 55
    end
    object QueryRComboioCIDADEUFOR: TStringField
      FieldName = 'CIDADEUFOR'
      ReadOnly = True
      Required = True
      Size = 55
    end
    object QueryRComboioCOMBOIOCLIENTE: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
    object QueryRComboioMCT: TStringField
      FieldName = 'MCT'
      Size = 50
    end
    object QueryRComboioDESCMERCADORIA: TStringField
      FieldName = 'DESCMERCADORIA'
      Size = 50
    end
    object QueryRComboioCODCOMBOIOVEICULO: TIntegerField
      FieldName = 'CODCOMBOIOVEICULO'
      Required = True
    end
    object QueryRComboioCONSULTAMOTORISTA: TStringField
      FieldName = 'CONSULTAMOTORISTA'
    end
  end
  object QueryRFatura: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.codcomboio, cb.data, cb.codcliente, cv.quantidade, cv.' +
        'peso, cv.numeroctrc, v.placa, r.descricao, r.numero, r.telemonit' +
        'orado, f.DATAEMISSAO, (cv.valortotal) as valor,'
      
        'origem.nome||'#39' - '#39'||origem.uf as cidorigem, destino.nome||'#39' - '#39'|' +
        '|destino.uf as ciddestino, f.obs1,'
      
        'cb.kmprevisto, cv.km, cb.codfatura, cli.nome, cli.endereco, cli.' +
        'cnpj, cli.ie, (cidcli.nome||'#39'-'#39'||cidcli.uf)as cidadecli, f.datai' +
        'nicio, f.datafim, f.desconto, (f.valortotal - f.desconto) as val' +
        'ortotal'
      
        'from comboio cb, comboioveiculo cv, rastreador r, cidade origem,' +
        ' cidade destino, veiculo v, fatura f, cliente cli, cidade cidcli'
      'where cb.codcomboio = cv.codcomboio'
      'and cb.codorigem = origem.codcidade'
      'and cb.coddestino = destino.codcidade'
      'and cv.codveiculo = v.codveiculo'
      'and cb.codfatura = :pcodfatura'
      'and cv.codrastreador = r.codrastreador'
      'and f.codfatura = cb.codfatura'
      'and f.codcliente = cli.codcliente'
      'and cidcli.codcidade = cli.codcidade'
      'order by cb.codcomboio')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    Left = 352
    Top = 112
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    object QueryRFaturaCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRFaturaNUMEROCTRC: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object QueryRFaturaPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRFaturaDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object QueryRFaturaNUMERO: TStringField
      FieldName = 'NUMERO'
    end
    object QueryRFaturaCIDORIGEM: TStringField
      FieldName = 'CIDORIGEM'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object QueryRFaturaCIDDESTINO: TStringField
      FieldName = 'CIDDESTINO'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object QueryRFaturaKMPREVISTO: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object QueryRFaturaKM: TIntegerField
      FieldName = 'KM'
    end
    object QueryRFaturaVALORTOTAL: TFloatField
      FieldName = 'VALORTOTAL'
      ReadOnly = True
      currency = True
    end
    object QueryRFaturaCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
    end
    object QueryRFaturaDATAEMISSAO: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object QueryRFaturaVALOR: TFloatField
      FieldName = 'VALOR'
      ReadOnly = True
      currency = True
    end
    object QueryRFaturaNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRFaturaENDERECO: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object QueryRFaturaCNPJ: TStringField
      FieldName = 'CNPJ'
    end
    object QueryRFaturaIE: TStringField
      FieldName = 'IE'
    end
    object QueryRFaturaCIDADECLI: TStringField
      FieldName = 'CIDADECLI'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRFaturaOBS1: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object QueryRFaturaDATAINICIO: TDateField
      FieldName = 'DATAINICIO'
    end
    object QueryRFaturaDATAFIM: TDateField
      FieldName = 'DATAFIM'
    end
    object QueryRFaturaQUANTIDADE: TIntegerField
      FieldName = 'QUANTIDADE'
    end
    object QueryRFaturaPESO: TFloatField
      FieldName = 'PESO'
      DisplayFormat = '###,###,###'
      EditFormat = '###,###,###'
    end
    object QueryRFaturaTELEMONITORADO: TSmallintField
      FieldName = 'TELEMONITORADO'
    end
    object QueryRFaturaDESCONTO: TFloatField
      FieldName = 'DESCONTO'
      currency = True
    end
    object QueryRFaturaDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRFaturaCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
  end
  object QueryRParcelaPagarPaga: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select pp.*, fr.nome, nt.obs1 from parcelapagar pp, nota nt, for' +
        'necedor fr'
      'where nt.codfornecedor = fr.codfornecedor'
      'and pp.codnota = nt.codnota')
    Params = <>
    Left = 352
    Top = 8
    object QueryRParcelaPagarPagaCODPARCELAPAGAR: TIntegerField
      FieldName = 'CODPARCELAPAGAR'
      Required = True
    end
    object QueryRParcelaPagarPagaCODNOTA: TIntegerField
      FieldName = 'CODNOTA'
    end
    object QueryRParcelaPagarPagaCODTRANSACAO: TIntegerField
      FieldName = 'CODTRANSACAO'
    end
    object QueryRParcelaPagarPagaDATAVENC: TDateField
      FieldName = 'DATAVENC'
    end
    object QueryRParcelaPagarPagaDATAPAG: TDateField
      FieldName = 'DATAPAG'
    end
    object QueryRParcelaPagarPagaVALORVENC: TFloatField
      FieldName = 'VALORVENC'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRParcelaPagarPagaVALORPAG: TFloatField
      FieldName = 'VALORPAG'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRParcelaPagarPagaNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 60
    end
    object QueryRParcelaPagarPagaOBS1: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object QueryRParcelaPagarPagaCODTIPOPAGAMENTO: TIntegerField
      FieldName = 'CODTIPOPAGAMENTO'
    end
    object QueryRParcelaPagarPagaVALORJUROS: TFloatField
      FieldName = 'VALORJUROS'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
  end
  object QueryRParcelaReceberRecebida: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select pr.*, cl.nome from parcelareceber pr, fatura ft, cliente ' +
        'cl'
      'where ft.codcliente = cl.codcliente'
      'and pr.codfatura = ft.codfatura')
    Params = <>
    Left = 432
    Top = 72
    object QueryRParcelaReceberRecebidaCODPARCELARECEBER: TIntegerField
      FieldName = 'CODPARCELARECEBER'
      Required = True
    end
    object QueryRParcelaReceberRecebidaCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
    end
    object QueryRParcelaReceberRecebidaCODTRANSACAO: TIntegerField
      FieldName = 'CODTRANSACAO'
    end
    object QueryRParcelaReceberRecebidaDATAREC: TDateField
      FieldName = 'DATAREC'
    end
    object QueryRParcelaReceberRecebidaDATAVENC: TDateField
      FieldName = 'DATAVENC'
    end
    object QueryRParcelaReceberRecebidaVALORVENC: TFloatField
      FieldName = 'VALORVENC'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRParcelaReceberRecebidaVALORREC: TFloatField
      FieldName = 'VALORREC'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRParcelaReceberRecebidaNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
  end
  object QueryRAviso: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select co.codcomboio, max(co.data)as data from comboioocorrencia' +
        ' co, parametro pr, comboio cb'
      'where cb.datachegada is null and co.codcomboio = cb.codcomboio'
      'group by co.codcomboio')
    Params = <>
    Left = 240
    Top = 16
    object QueryRAvisoCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRAvisoDATA: TDateTimeField
      FieldName = 'DATA'
      ReadOnly = True
    end
  end
  object QueryRCombOcorrDig: TZQuery
    Connection = DMprinc.ZConnection1
    AfterOpen = QueryRCombOcorrDigAfterOpen
    OnCalcFields = QueryRCombOcorrDigCalcFields
    SQL.Strings = (
      'select * from comboioocorrencia'
      '')
    Params = <>
    Left = 240
    Top = 72
    object QueryRCombOcorrDigCODCOMBOIOOCORRENCIA: TIntegerField
      FieldName = 'CODCOMBOIOOCORRENCIA'
      Required = True
    end
    object QueryRCombOcorrDigDATA: TDateTimeField
      FieldName = 'DATA'
    end
    object QueryRCombOcorrDigOBS: TStringField
      FieldName = 'OBS'
      Size = 50
    end
    object QueryRCombOcorrDigCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRCombOcorrDigCODOCORRENCIA: TIntegerField
      FieldName = 'CODOCORRENCIA'
    end
    object QueryRCombOcorrDigCODCIDADE: TIntegerField
      FieldName = 'CODCIDADE'
    end
    object QueryRCombOcorrDigCODITEM: TIntegerField
      FieldName = 'CODITEM'
    end
    object QueryRCombOcorrDigVALOR: TFloatField
      FieldName = 'VALOR'
    end
    object QueryRCombOcorrDigLOCAL: TStringField
      FieldName = 'LOCAL'
      Size = 50
    end
    object QueryRCombOcorrDigDATADIG: TDateTimeField
      FieldName = 'DATADIG'
    end
    object QueryRCombOcorrDigUSUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
    object QueryRCombOcorrDigTempo: TTimeField
      FieldKind = fkCalculated
      FieldName = 'Tempo'
      Calculated = True
    end
  end
  object QueryComboioOcorrenciaExp: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select l.descricao as descLocal,co.*, cid.nome as nomecid, cid.u' +
        'f, o.descricao as descocorrencia'
      
        'from comboioOcorrencia co, cidade cid, ocorrencia o, local l, co' +
        'mboio cb'
      'where cid.codcidade = co.codcidade'
      'and co.codocorrencia = o.codocorrencia'
      'and l.codlocal = co.codlocal'
      'and co.telemonitorado = 0'
      'and cb.codcomboio = co.codcomboio'
      'and cb.comboiocliente is not null'
      
        'and ((cb.codcliente = 333) or (cb.codcliente = 113) or (cb.codcl' +
        'iente = 6) )')
    Params = <>
    Left = 240
    Top = 136
    object QueryComboioOcorrenciaExpCODCOMBOIOOCORRENCIA: TIntegerField
      FieldName = 'CODCOMBOIOOCORRENCIA'
      Required = True
    end
    object QueryComboioOcorrenciaExpDATA: TDateTimeField
      FieldName = 'DATA'
    end
    object QueryComboioOcorrenciaExpOBS: TStringField
      FieldName = 'OBS'
      Size = 50
    end
    object QueryComboioOcorrenciaExpCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryComboioOcorrenciaExpCODOCORRENCIA: TIntegerField
      FieldName = 'CODOCORRENCIA'
    end
    object QueryComboioOcorrenciaExpCODCIDADE: TIntegerField
      FieldName = 'CODCIDADE'
    end
    object QueryComboioOcorrenciaExpCODITEM: TIntegerField
      FieldName = 'CODITEM'
    end
    object QueryComboioOcorrenciaExpVALOR: TFloatField
      FieldName = 'VALOR'
    end
    object QueryComboioOcorrenciaExpLOCAL: TStringField
      FieldName = 'LOCAL'
      Size = 50
    end
    object QueryComboioOcorrenciaExpDATADIG: TDateTimeField
      FieldName = 'DATADIG'
    end
    object QueryComboioOcorrenciaExpUSUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
    object QueryComboioOcorrenciaExpEXPORTADO: TSmallintField
      FieldName = 'EXPORTADO'
    end
    object QueryComboioOcorrenciaExpALTINS: TStringField
      FieldName = 'ALTINS'
      Size = 1
    end
    object QueryComboioOcorrenciaExpNOMECID: TStringField
      FieldName = 'NOMECID'
      Required = True
      Size = 50
    end
    object QueryComboioOcorrenciaExpUF: TStringField
      FieldName = 'UF'
      Required = True
      Size = 2
    end
    object QueryComboioOcorrenciaExpDESCOCORRENCIA: TStringField
      FieldName = 'DESCOCORRENCIA'
      Size = 100
    end
    object QueryComboioOcorrenciaExpDESCLOCAL: TStringField
      FieldName = 'DESCLOCAL'
      Size = 50
    end
    object QueryComboioOcorrenciaExpTELEMONITORADO: TSmallintField
      FieldName = 'TELEMONITORADO'
    end
    object QueryComboioOcorrenciaExpCODLOCAL: TIntegerField
      FieldName = 'CODLOCAL'
    end
    object QueryComboioOcorrenciaExpCODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
    end
    object QueryComboioOcorrenciaExpDATAALT: TDateTimeField
      FieldName = 'DATAALT'
    end
    object QueryComboioOcorrenciaExpUSUARIOALT: TStringField
      FieldName = 'USUARIOALT'
    end
  end
  object QueryComboioExp: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select cb.* from comboio cb'
      'where exportado = 0'
      
        'and ((cb.codcliente = 333) or (cb.codcliente = 113) or (cb.codcl' +
        'iente = 6) )')
    Params = <>
    Left = 240
    Top = 192
    object QueryComboioExpCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryComboioExpDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryComboioExpPREVISAOSAIDA: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object QueryComboioExpKMPREVISTO: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object QueryComboioExpCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object QueryComboioExpCODRASTREADOR: TIntegerField
      FieldName = 'CODRASTREADOR'
    end
    object QueryComboioExpCODORIGEM: TIntegerField
      FieldName = 'CODORIGEM'
    end
    object QueryComboioExpCODDESTINO: TIntegerField
      FieldName = 'CODDESTINO'
    end
    object QueryComboioExpCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
    end
    object QueryComboioExpVALOR: TFloatField
      FieldName = 'VALOR'
    end
    object QueryComboioExpVALORKM: TFloatField
      FieldName = 'VALORKM'
    end
    object QueryComboioExpPREVISAOCHEGADA: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object QueryComboioExpDATACHEGADA: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object QueryComboioExpEXPORTADO: TSmallintField
      FieldName = 'EXPORTADO'
    end
    object QueryComboioExpCOMBOIOCLIENTE: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
    object QueryComboioExpUSUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
    object QueryComboioExpSITE: TSmallintField
      FieldName = 'SITE'
    end
    object QueryComboioExpESPECIAL: TSmallintField
      FieldName = 'ESPECIAL'
    end
  end
  object QueryRComboioConf: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.*, cli.nome as nomecliente, r.descricao as nomerastrea' +
        'dor,'
      
        '(cidor.nome||'#39'-'#39'|| cidor.uf )as cidadeorigem,(cidde.nome||'#39'-'#39'|| ' +
        'cidde.uf )as cidadedestino,'
      
        '(select first 1 v.placa from veiculo v where v.codveiculo = cv.c' +
        'odveiculo) as veiculo'
      
        'from Comboio cb, cliente cli, rastreador r, cidade cidor, cidade' +
        ' cidde, comboioveiculo cv'
      'where cb.codcliente = cli.codcliente'
      'and r.codrastreador = cb.codrastreador'
      'and cb.codorigem = cidor.codcidade'
      'and cb.coddestino = cidde.codcidade'
      'and cv.codcomboio = cb.codcomboio')
    Params = <>
    Left = 168
    Top = 24
    object QueryRComboioConfCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRComboioConfDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRComboioConfPREVISAOSAIDA: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object QueryRComboioConfKMPREVISTO: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object QueryRComboioConfCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object QueryRComboioConfCODRASTREADOR: TIntegerField
      FieldName = 'CODRASTREADOR'
    end
    object QueryRComboioConfCODORIGEM: TIntegerField
      FieldName = 'CODORIGEM'
    end
    object QueryRComboioConfCODDESTINO: TIntegerField
      FieldName = 'CODDESTINO'
    end
    object QueryRComboioConfCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
    end
    object QueryRComboioConfVALOR: TFloatField
      FieldName = 'VALOR'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRComboioConfVALORKM: TFloatField
      FieldName = 'VALORKM'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRComboioConfPREVISAOCHEGADA: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object QueryRComboioConfDATACHEGADA: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object QueryRComboioConfEXPORTADO: TSmallintField
      FieldName = 'EXPORTADO'
    end
    object QueryRComboioConfCOMBOIOCLIENTE: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
    object QueryRComboioConfNOMECLIENTE: TStringField
      FieldName = 'NOMECLIENTE'
      Required = True
      Size = 50
    end
    object QueryRComboioConfNOMERASTREADOR: TStringField
      FieldName = 'NOMERASTREADOR'
      Size = 50
    end
    object QueryRComboioConfCIDADEORIGEM: TStringField
      FieldName = 'CIDADEORIGEM'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioConfCIDADEDESTINO: TStringField
      FieldName = 'CIDADEDESTINO'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioConfUSUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
    object QueryRComboioConfSITE: TSmallintField
      FieldName = 'SITE'
    end
    object QueryRComboioConfESPECIAL: TSmallintField
      FieldName = 'ESPECIAL'
    end
    object QueryRComboioConfCODROTA: TIntegerField
      FieldName = 'CODROTA'
    end
    object QueryRComboioConfCODTIPOOPERACAO: TIntegerField
      FieldName = 'CODTIPOOPERACAO'
    end
    object QueryRComboioConfCODLOCALENTREGA: TIntegerField
      FieldName = 'CODLOCALENTREGA'
    end
    object QueryRComboioConfCODLOCALCOLETA: TIntegerField
      FieldName = 'CODLOCALCOLETA'
    end
    object QueryRComboioConfSTATUS: TSmallintField
      FieldName = 'STATUS'
    end
    object QueryRComboioConfHORA: TTimeField
      FieldName = 'HORA'
    end
    object QueryRComboioConfVEICULO: TStringField
      FieldName = 'VEICULO'
      ReadOnly = True
      Size = 8
    end
  end
  object QueryRComboioOcorrencia: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select co.codcomboioocorrencia,co.obs, co.data, co.codcomboio, (' +
        'cid.nome||'#39'-'#39'|| cid.uf )as nomecidade, o.descricao as nomeocorre' +
        'cia, l.descricao as local, co.codveiculo, co.origemcontato'
      'from comboioocorrencia co, cidade cid, ocorrencia o, local l'
      'where co.codocorrencia = o.codocorrencia'
      'and cid.codcidade =  co.codcidade'
      'and co.codlocal = l.codlocal')
    Params = <>
    Left = 160
    Top = 80
    object QueryRComboioOcorrenciaOBS: TStringField
      FieldName = 'OBS'
      Size = 50
    end
    object QueryRComboioOcorrenciaDATA: TDateTimeField
      FieldName = 'DATA'
    end
    object QueryRComboioOcorrenciaCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRComboioOcorrenciaNOMECIDADE: TStringField
      FieldName = 'NOMECIDADE'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioOcorrenciaNOMEOCORRECIA: TStringField
      FieldName = 'NOMEOCORRECIA'
      Size = 100
    end
    object QueryRComboioOcorrenciaCODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
    end
    object QueryRComboioOcorrenciaLOCAL: TStringField
      FieldName = 'LOCAL'
      Size = 50
    end
    object QueryRComboioOcorrenciaCODCOMBOIOOCORRENCIA: TIntegerField
      FieldName = 'CODCOMBOIOOCORRENCIA'
      Required = True
    end
    object QueryRComboioOcorrenciaORIGEMCONTATO: TStringField
      FieldName = 'ORIGEMCONTATO'
    end
  end
  object QueryRComboioConf2: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.data, cb.codcomboio, cb.codcliente,cli.nome as nomecli' +
        'ente, r.descricao as nomerastreador, '
      
        '(cidor.nome||'#39'-'#39'|| cidor.uf )as cidadeorigem,(cidde.nome||'#39'-'#39'|| ' +
        'cidde.uf )as cidadedestino,'
      
        'v.codveiculo, v.placa, (cv.valorkm * cv.km) as valorplaca, cv.km' +
        ', cv.valorkm'
      
        'from Comboio cb, cliente cli, rastreador r, cidade cidor, cidade' +
        ' cidde, veiculo v, comboioveiculo cv'
      'where cb.codcliente = cli.codcliente'
      'and r.codrastreador = cv.codrastreador'
      'and cb.codorigem = cidor.codcidade'
      'and cb.coddestino = cidde.codcidade'
      'and cv.codcomboio = cb.codcomboio'
      'and cv.codveiculo = v.codveiculo')
    Params = <>
    Left = 64
    Top = 32
    object QueryRComboioConf2DATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRComboioConf2NOMECLIENTE: TStringField
      FieldName = 'NOMECLIENTE'
      Required = True
      Size = 50
    end
    object QueryRComboioConf2NOMERASTREADOR: TStringField
      FieldName = 'NOMERASTREADOR'
      Size = 50
    end
    object QueryRComboioConf2CIDADEORIGEM: TStringField
      FieldName = 'CIDADEORIGEM'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioConf2CIDADEDESTINO: TStringField
      FieldName = 'CIDADEDESTINO'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioConf2CODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
      Required = True
    end
    object QueryRComboioConf2PLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRComboioConf2VALORPLACA: TFloatField
      FieldName = 'VALORPLACA'
      ReadOnly = True
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRComboioConf2KM: TIntegerField
      FieldName = 'KM'
    end
    object QueryRComboioConf2VALORKM: TFloatField
      FieldName = 'VALORKM'
    end
    object QueryRComboioConf2CODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRComboioConf2CODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
  end
  object QueryRFaturamento: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.codcomboio, cli.nome, cb.valor, (ciddest.nome||'#39'-'#39'||ci' +
        'ddest.uf) as destino, (cidorig.nome||'#39'-'#39'||cidorig.uf) as origem,' +
        ' cb.codfatura'
      'from comboio cb, cliente cli, cidade cidorig, cidade ciddest'
      'where cli.codcliente = cb.codcliente'
      'and cb.codorigem = cidorig.codcidade'
      'and cb.coddestino = ciddest.codcidade'
      '')
    Params = <>
    Left = 88
    Top = 192
    object QueryRFaturamentoCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRFaturamentoNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRFaturamentoVALOR: TFloatField
      FieldName = 'VALOR'
      currency = True
    end
    object QueryRFaturamentoDESTINO: TStringField
      FieldName = 'DESTINO'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRFaturamentoORIGEM: TStringField
      FieldName = 'ORIGEM'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRFaturamentoCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
    end
  end
  object QueryRFaturaRastreador: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select r.descricao, count(*) as quantidade'
      'from comboio cb, comboioveiculo cv, rastreador r'
      'where cb.codcomboio = cv.codcomboio'
      'and cb.codfatura = :pcodfatura'
      'and cv.codrastreador = r.codrastreador'
      ''
      '')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    Left = 240
    Top = 248
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    object QueryRFaturaRastreadorDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object QueryRFaturaRastreadorQUANTIDADE: TIntegerField
      FieldName = 'QUANTIDADE'
      ReadOnly = True
      Required = True
    end
  end
  object QueryRDespesa: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select ((pp.valorpag *((itn.valortotal*100)/n.valorpag))/100)  a' +
        's parc,'
      
        'itn.valortotal, it.descricao as descitem, gr.descricao as descgr' +
        'upo, pp.valorvenc, n.codnota, pp.datapag, n.obs1'
      'from nota n, itemnota itn, grupo gr, item it, parcelapagar pp'
      'where itn.codnota = n.codnota'
      'and it.codgrupo = gr.codgrupo'
      'and it.coditem = itn.coditem'
      'and pp.codnota = n.codnota'
      'and pp.valorpag is not null')
    Params = <>
    Left = 352
    Top = 224
    object QueryRDespesaPARC: TFloatField
      FieldName = 'PARC'
      ReadOnly = True
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRDespesaVALORTOTAL: TFloatField
      FieldName = 'VALORTOTAL'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRDespesaDESCITEM: TStringField
      FieldName = 'DESCITEM'
      Size = 50
    end
    object QueryRDespesaDESCGRUPO: TStringField
      FieldName = 'DESCGRUPO'
      Size = 50
    end
    object QueryRDespesaVALORVENC: TFloatField
      FieldName = 'VALORVENC'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object QueryRDespesaCODNOTA: TIntegerField
      FieldName = 'CODNOTA'
      Required = True
    end
    object QueryRDespesaOBS1: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object QueryRDespesaDATAPAG: TDateField
      FieldName = 'DATAPAG'
    end
  end
  object QueryLog: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select * from log')
    Params = <>
    Left = 352
    Top = 272
  end
  object QueryRCombOcorrConf: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select usuariodig, datadig, usuarioalt, dataalt, codcomboio, cod' +
        'comboioocorrencia from comboioocorrencia'
      'where usuarioalt is not null')
    Params = <>
    Left = 232
    Top = 304
    object QueryRCombOcorrConfUSUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
    object QueryRCombOcorrConfDATADIG: TDateTimeField
      FieldName = 'DATADIG'
    end
    object QueryRCombOcorrConfUSUARIOALT: TStringField
      FieldName = 'USUARIOALT'
    end
    object QueryRCombOcorrConfDATAALT: TDateTimeField
      FieldName = 'DATAALT'
    end
    object QueryRCombOcorrConfCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRCombOcorrConfCODCOMBOIOOCORRENCIA: TIntegerField
      FieldName = 'CODCOMBOIOOCORRENCIA'
      Required = True
    end
  end
  object QueryRFatura2: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select sum(cv.peso) as SomaPeso, count(*) as QtViagens, v.placa,' +
        ' sum(cv.km) as SomaKM,'
      ' sum(v.valormensal) as valormensal, cv.codcomboioveiculo'
      
        'from comboio cb, comboioveiculo cv, rastreador r, cidade origem,' +
        ' cidade destino, veiculo v, fatura f, cliente cli, cidade cidcli'
      'where cb.codcomboio = cv.codcomboio'
      'and cb.codorigem = origem.codcidade'
      'and cb.coddestino = destino.codcidade'
      'and cv.codveiculo = v.codveiculo'
      'and cb.codfatura = :pcodfatura'
      'and cv.codrastreador = r.codrastreador'
      'and f.codfatura = cb.codfatura'
      'and f.codcliente = cli.codcliente'
      'and cidcli.codcidade = cli.codcidade'
      'and v.valormensal > 0'
      'group by v.placa, cv.codcomboioveiculo'
      'order by v.placa')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    Left = 448
    Top = 112
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    object QueryRFatura2SOMAPESO: TFloatField
      FieldName = 'SOMAPESO'
      ReadOnly = True
    end
    object QueryRFatura2QTVIAGENS: TIntegerField
      FieldName = 'QTVIAGENS'
      ReadOnly = True
      Required = True
    end
    object QueryRFatura2PLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRFatura2SOMAKM: TLargeintField
      FieldName = 'SOMAKM'
      ReadOnly = True
    end
    object QueryRFatura2VALORMENSAL: TFloatField
      FieldName = 'VALORMENSAL'
      ReadOnly = True
      currency = True
    end
    object QueryRFatura2CODCOMBOIOVEICULO: TIntegerField
      FieldName = 'CODCOMBOIOVEICULO'
      Required = True
    end
  end
  object QueryExtratoConta: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select tr.*, c.numeroconta from transacao tr, conta c'
      'where c.codconta = tr.codconta'
      '')
    Params = <>
    Left = 480
    Top = 8
    object QueryExtratoContaCODTRANSACAO: TIntegerField
      FieldName = 'CODTRANSACAO'
      Required = True
    end
    object QueryExtratoContaDATA: TDateField
      FieldName = 'DATA'
      Required = True
    end
    object QueryExtratoContaVALOR: TFloatField
      FieldName = 'VALOR'
      Required = True
      DisplayFormat = '###,###.00'
    end
    object QueryExtratoContaCODCONTA: TIntegerField
      FieldName = 'CODCONTA'
      Required = True
    end
    object QueryExtratoContaTIPO: TStringField
      FieldName = 'TIPO'
      Required = True
      Size = 1
    end
    object QueryExtratoContaDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 60
    end
    object QueryExtratoContaPENDENTE: TSmallintField
      FieldName = 'PENDENTE'
    end
    object QueryExtratoContaNUMEROCONTA: TStringField
      FieldName = 'NUMEROCONTA'
      Required = True
      Size = 10
    end
  end
  object QueryRComboioAberto: TZQuery
    Connection = DMprinc.ZConnection1
    OnCalcFields = QueryRComboioAbertoCalcFields
    SQL.Strings = (
      'select distinct cb.*, r.descricao as nomerastreador, vei.placa,'
      '(cidor.nome||'#39'-'#39'|| cidor.uf )as cidadeorigem,'
      
        '(cidde.nome||'#39'-'#39'|| cidde.uf )as cidadedestino, m.nome, m.celular' +
        ','
      
        'cv.codcomboioveiculo, r2.descricao as rastreadorveiculo, cb.usua' +
        'riodig, cli.nome as nomecliente'
      
        'from veiculo vei, rastreador r, cidade cidor, cidade cidde, moto' +
        'rista m,'
      'comboioveiculo cv, rastreador r2, cliente cli, Comboio cb'
      
        'left outer join comboioocorrencia co on(cb.codcomboio = co.codco' +
        'mboio)'
      'where r.codrastreador = cb.codrastreador'
      'and cb.codorigem = cidor.codcidade'
      'and cb.coddestino = cidde.codcidade'
      'and cv.codmotorista = m.codmotorista'
      'and cv.codcomboio = cb.codcomboio'
      'and r2.codrastreador = cv.codrastreador'
      'and cb.datachegada is null'
      'and cb.codcliente = cli.codcliente'
      'and cv.codveiculo = vei.codveiculo')
    Params = <>
    Left = 456
    Top = 232
    object QueryRComboioAbertoCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRComboioAbertoDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRComboioAbertoPREVISAOSAIDA: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object QueryRComboioAbertoKMPREVISTO: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object QueryRComboioAbertoCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object QueryRComboioAbertoCODRASTREADOR: TIntegerField
      FieldName = 'CODRASTREADOR'
    end
    object QueryRComboioAbertoCODORIGEM: TIntegerField
      FieldName = 'CODORIGEM'
    end
    object QueryRComboioAbertoCODDESTINO: TIntegerField
      FieldName = 'CODDESTINO'
    end
    object QueryRComboioAbertoCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
    end
    object QueryRComboioAbertoVALOR: TFloatField
      FieldName = 'VALOR'
    end
    object QueryRComboioAbertoVALORKM: TFloatField
      FieldName = 'VALORKM'
    end
    object QueryRComboioAbertoPREVISAOCHEGADA: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object QueryRComboioAbertoDATACHEGADA: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object QueryRComboioAbertoEXPORTADO: TSmallintField
      FieldName = 'EXPORTADO'
    end
    object QueryRComboioAbertoCOMBOIOCLIENTE: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
    object QueryRComboioAbertoUSUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
    object QueryRComboioAbertoNOMERASTREADOR: TStringField
      FieldName = 'NOMERASTREADOR'
      Size = 50
    end
    object QueryRComboioAbertoCIDADEORIGEM: TStringField
      FieldName = 'CIDADEORIGEM'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioAbertoCIDADEDESTINO: TStringField
      FieldName = 'CIDADEDESTINO'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRComboioAbertoNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryRComboioAbertoCELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRComboioAbertoCODCOMBOIOVEICULO: TIntegerField
      FieldName = 'CODCOMBOIOVEICULO'
      Required = True
    end
    object QueryRComboioAbertoRASTREADORVEICULO: TStringField
      FieldName = 'RASTREADORVEICULO'
      Size = 50
    end
    object QueryRComboioAbertoUSUARIODIG_1: TStringField
      FieldName = 'USUARIODIG_1'
    end
    object QueryRComboioAbertoUltimaPosicao: TStringField
      FieldKind = fkCalculated
      FieldName = 'UltimaPosicao'
      Calculated = True
    end
    object QueryRComboioAbertoSITE: TSmallintField
      FieldName = 'SITE'
    end
    object QueryRComboioAbertoESPECIAL: TSmallintField
      FieldName = 'ESPECIAL'
    end
    object QueryRComboioAbertoCODROTA: TIntegerField
      FieldName = 'CODROTA'
    end
    object QueryRComboioAbertoCODTIPOOPERACAO: TIntegerField
      FieldName = 'CODTIPOOPERACAO'
    end
    object QueryRComboioAbertoCODLOCALENTREGA: TIntegerField
      FieldName = 'CODLOCALENTREGA'
    end
    object QueryRComboioAbertoCODLOCALCOLETA: TIntegerField
      FieldName = 'CODLOCALCOLETA'
    end
    object QueryRComboioAbertoPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRComboioAbertoSTATUS: TSmallintField
      FieldName = 'STATUS'
    end
    object QueryRComboioAbertoNOMECLIENTE: TStringField
      FieldName = 'NOMECLIENTE'
      Required = True
      Size = 50
    end
  end
  object QueryRChequePendente: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select ch.nominal, ch.numerocheque, ch.dataemissao, ch.dataprevi' +
        'sta,'
      'ch.valor, ct.numeroconta, ct.banco'
      'from cheque ch, conta ct, transacao t'
      'where ct.codconta = ch.codconta'
      'and t.pendente = -1'
      'and t.codtransacao = ch.codtransacao'
      '')
    Params = <>
    Left = 104
    Top = 264
    object QueryRChequePendenteNOMINAL: TStringField
      FieldName = 'NOMINAL'
      Size = 50
    end
    object QueryRChequePendenteNUMEROCHEQUE: TIntegerField
      FieldName = 'NUMEROCHEQUE'
    end
    object QueryRChequePendenteDATAEMISSAO: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object QueryRChequePendenteDATAPREVISTA: TDateField
      FieldName = 'DATAPREVISTA'
    end
    object QueryRChequePendenteVALOR: TFloatField
      FieldName = 'VALOR'
      DisplayFormat = '###,###.00'
    end
    object QueryRChequePendenteNUMEROCONTA: TStringField
      FieldName = 'NUMEROCONTA'
    end
    object QueryRChequePendenteBANCO: TStringField
      FieldName = 'BANCO'
    end
  end
  object QueryRAnomalia: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select an.codanomalia, o.descricao, an.datastart, an.datastop, a' +
        'n.usuariostart, an.atitude, m.nome, v.placa'
      'from motorista m, ocorrencia o , anomalia an'
      'left outer join veiculo v on (v.codveiculo = an.codveiculo)'
      'where (o.codocorrencia = an.codocorrencia)'
      'and (m.codmotorista = an.codmotorista)'
      'and ((an.anso = 0) or (an.anso is null))')
    Params = <>
    Left = 456
    Top = 168
    object QueryRAnomaliaDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 100
    end
    object QueryRAnomaliaDATASTART: TDateTimeField
      FieldName = 'DATASTART'
    end
    object QueryRAnomaliaDATASTOP: TDateTimeField
      FieldName = 'DATASTOP'
    end
    object QueryRAnomaliaUSUARIOSTART: TStringField
      FieldName = 'USUARIOSTART'
      Size = 50
    end
    object QueryRAnomaliaATITUDE: TStringField
      FieldName = 'ATITUDE'
      Size = 500
    end
    object QueryRAnomaliaNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryRAnomaliaPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
  end
  object QueryRVeiculosRastreados: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select distinct (cv.codveiculo), cli.nome, cb.data, cb.codcomboi' +
        'o, v.placa, extract(month from cb.data) as mes'
      'from comboio cb, comboioveiculo cv, cliente cli, veiculo v'
      'where cb.codcliente = cli.codcliente'
      'and cb.codcomboio = cv.codcomboio'
      'and v.codveiculo = cv.codveiculo'
      '')
    Params = <>
    Left = 448
    Top = 304
    object QueryRVeiculosRastreadosCODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
    end
    object QueryRVeiculosRastreadosNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRVeiculosRastreadosDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRVeiculosRastreadosCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRVeiculosRastreadosPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRVeiculosRastreadosMES: TSmallintField
      FieldName = 'MES'
      ReadOnly = True
    end
  end
  object QueryRPlanoContas: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select it.descricao  as item, it.coditem, gr.descricao as grupo,' +
        ' gr.codgrupo'
      ' from item it, grupo gr'
      'where gr.codgrupo = it.codgrupo'
      'order by gr.descricao, it.descricao')
    Params = <>
    Left = 528
    Top = 24
    object QueryRPlanoContasITEM: TStringField
      FieldName = 'ITEM'
      Size = 50
    end
    object QueryRPlanoContasCODITEM: TIntegerField
      FieldName = 'CODITEM'
      Required = True
    end
    object QueryRPlanoContasGRUPO: TStringField
      FieldName = 'GRUPO'
      Size = 50
    end
    object QueryRPlanoContasCODGRUPO: TIntegerField
      FieldName = 'CODGRUPO'
      Required = True
    end
  end
  object QueryRDuplicata: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select pr.codfatura, f.DATAEMISSAO, pr.datavenc, pr.valorvenc, f' +
        '.desconto,'
      
        'f.obs1, cli.nome, cli.endereco, cli.cnpj, cli.ie, (cidcli.nome||' +
        #39'-'#39'||cidcli.uf)as cidadecli,'
      'f.datainicio, f.datafim'
      'from parcelareceber pr, fatura f, cliente cli, cidade cidcli'
      'where f.codcliente = cli.codcliente'
      'and cidcli.codcidade = cli.codcidade'
      'and f.codfatura = pr.codfatura'
      'and pr.codparcelareceber = :pcod'
      'order by pr.codparcelareceber')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcod'
        ParamType = ptUnknown
      end>
    Left = 528
    Top = 88
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcod'
        ParamType = ptUnknown
      end>
  end
  object QueryRDestinosComboio: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select (cid.nome||'#39'-'#39'||cid.uf) as cidadeuf,v.placa'
      'from veiculo v, destino des, cidade cid'
      'where des.codcidade = cid.codcidade'
      'and v.codveiculo = des.codveiculo'
      'and des.codcomboio =:pcod')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcod'
        ParamType = ptUnknown
      end>
    Left = 640
    Top = 176
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcod'
        ParamType = ptUnknown
      end>
    object QueryRDestinosComboioCIDADEUF: TStringField
      FieldName = 'CIDADEUF'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRDestinosComboioPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
  end
  object dsRelat2: TDataSource
    DataSet = QueryRDestinosComboio
    Left = 64
    Top = 144
  end
  object QueryRPrazoRec: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select (pr.datarec- pr.datavenc) as dias, cli.nome, pr.datavenc,' +
        ' pr.datarec, f.codfatura, pr.codparcelareceber, pr.valorvenc'
      'from parcelareceber pr, fatura f, cliente cli'
      'where pr.datarec is not null'
      'and pr.codfatura = f.codfatura'
      'and cli.codcliente = f.codcliente'
      '')
    Params = <>
    Left = 552
    Top = 240
    object QueryRPrazoRecDIAS: TIntegerField
      FieldName = 'DIAS'
      ReadOnly = True
    end
    object QueryRPrazoRecNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRPrazoRecDATAVENC: TDateField
      FieldName = 'DATAVENC'
    end
    object QueryRPrazoRecDATAREC: TDateField
      FieldName = 'DATAREC'
    end
    object QueryRPrazoRecCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
      Required = True
    end
    object QueryRPrazoRecCODPARCELARECEBER: TIntegerField
      FieldName = 'CODPARCELARECEBER'
      Required = True
    end
    object QueryRPrazoRecVALORVENC: TFloatField
      FieldName = 'VALORVENC'
    end
  end
  object QueryRParcelaPagarPaga2: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select pp.*, fr.nome, nt.obs1'
      
        'from nota nt, fornecedor fr, parcelapagar pp left outer join tra' +
        'nsacao tr on (pp.codtransacao = tr.codtransacao)'
      'where nt.codfornecedor = fr.codfornecedor'
      'and pp.codnota = nt.codnota'
      'and ((tr.pendente = -1) or pp.datapag is null)'
      '')
    Params = <>
    Left = 352
    Top = 32
    object IntegerField1: TIntegerField
      FieldName = 'CODPARCELAPAGAR'
      Required = True
    end
    object IntegerField2: TIntegerField
      FieldName = 'CODNOTA'
    end
    object IntegerField3: TIntegerField
      FieldName = 'CODTRANSACAO'
    end
    object DateField1: TDateField
      FieldName = 'DATAVENC'
    end
    object DateField2: TDateField
      FieldName = 'DATAPAG'
    end
    object FloatField1: TFloatField
      FieldName = 'VALORVENC'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object FloatField2: TFloatField
      FieldName = 'VALORPAG'
      DisplayFormat = '###,###.00'
      EditFormat = '###,###.00'
    end
    object StringField1: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 60
    end
    object StringField2: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
  end
  object QueryRFatLocacao: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select f.codfatura, f.dataemissao, f.valortotal, cli.nome, f.obs' +
        '1, f.datainicio, f.datafim, f.desconto,'
      
        'lc.datainstalacao, lc.datadesinstalacao, lc.codequipamento, lc.c' +
        'odcomboio, lc.valorlocacao, lc.valorcomunicacao,'
      
        '(cidor.nome||'#39'-'#39'||cidor.uf) as origem,(cidde.nome||'#39'-'#39'||cidde.uf' +
        ') as destino, (cidcli.nome||'#39'-'#39'||cidcli.uf) as cidcliente, cli.e' +
        'ndereco,'
      'cli.ie, cli.cnpj, lc.codlocacao, m.nome as nomemot, vei.placa'
      
        'from fatura f, cliente cli, locacao lc, comboio cb, cidade cidor' +
        ', cidade cidde, cidade cidcli, motorista m, veiculo vei, comboio' +
        'veiculo cv'
      'where cli.codcliente = f.codcliente'
      'and lc.codfatura = f.codfatura'
      'and lc.codcomboio = cb.codcomboio'
      'and cb.codorigem = cidor.codcidade'
      'and cb.coddestino = cidde.codcidade'
      'and cli.codcidade = cidcli.codcidade'
      'and f.codfatura = :pcodfat'
      'and cv.codcomboio = cb.codcomboio'
      'and cv.codveiculo = vei.codveiculo'
      'and cv.codmotorista = m.codmotorista'
      'order by lc.datainstalacao')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfat'
        ParamType = ptUnknown
      end>
    Left = 552
    Top = 304
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfat'
        ParamType = ptUnknown
      end>
    object QueryRFatLocacaoCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
      Required = True
    end
    object QueryRFatLocacaoDATAEMISSAO: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object QueryRFatLocacaoVALORTOTAL: TFloatField
      FieldName = 'VALORTOTAL'
      DisplayFormat = '###,###.00'
    end
    object QueryRFatLocacaoNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRFatLocacaoOBS1: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object QueryRFatLocacaoDATAINICIO: TDateField
      FieldName = 'DATAINICIO'
    end
    object QueryRFatLocacaoDATAFIM: TDateField
      FieldName = 'DATAFIM'
    end
    object QueryRFatLocacaoDESCONTO: TFloatField
      FieldName = 'DESCONTO'
    end
    object QueryRFatLocacaoDATAINSTALACAO: TDateTimeField
      FieldName = 'DATAINSTALACAO'
    end
    object QueryRFatLocacaoDATADESINSTALACAO: TDateTimeField
      FieldName = 'DATADESINSTALACAO'
    end
    object QueryRFatLocacaoCODEQUIPAMENTO: TIntegerField
      FieldName = 'CODEQUIPAMENTO'
    end
    object QueryRFatLocacaoCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRFatLocacaoVALORLOCACAO: TFloatField
      FieldName = 'VALORLOCACAO'
      DisplayFormat = '###,###0.00'
    end
    object QueryRFatLocacaoVALORCOMUNICACAO: TFloatField
      FieldName = 'VALORCOMUNICACAO'
      DisplayFormat = '###,###0.00'
    end
    object QueryRFatLocacaoORIGEM: TStringField
      FieldName = 'ORIGEM'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRFatLocacaoDESTINO: TStringField
      FieldName = 'DESTINO'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRFatLocacaoCIDCLIENTE: TStringField
      FieldName = 'CIDCLIENTE'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryRFatLocacaoENDERECO: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object QueryRFatLocacaoIE: TStringField
      FieldName = 'IE'
    end
    object QueryRFatLocacaoCNPJ: TStringField
      FieldName = 'CNPJ'
    end
    object QueryRFatLocacaoCODLOCACAO: TIntegerField
      FieldName = 'CODLOCACAO'
      Required = True
    end
    object QueryRFatLocacaoPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRFatLocacaoNOMEMOT: TStringField
      FieldName = 'NOMEMOT'
      Size = 50
    end
  end
  object QueryComboioExp2: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.*, cv.codexterno, cv.datainidescarga, cv.datafindescar' +
        'ga '
      'from comboio cb, comboioveiculo cv'
      'where exportado = 0'
      'and cv.codexterno is not null'
      'and cb.codcomboio = cv.codcomboio'
      
        'and ((cb.codcliente = 333) or (cb.codcliente = 113) or (cb.codcl' +
        'iente = 6) )')
    Params = <>
    Left = 167
    Top = 192
    object IntegerField4: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object DateField3: TDateField
      FieldName = 'DATA'
    end
    object DateTimeField1: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object IntegerField5: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object IntegerField6: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object IntegerField7: TIntegerField
      FieldName = 'CODRASTREADOR'
    end
    object IntegerField8: TIntegerField
      FieldName = 'CODORIGEM'
    end
    object IntegerField9: TIntegerField
      FieldName = 'CODDESTINO'
    end
    object IntegerField10: TIntegerField
      FieldName = 'CODFATURA'
    end
    object FloatField3: TFloatField
      FieldName = 'VALOR'
    end
    object FloatField4: TFloatField
      FieldName = 'VALORKM'
    end
    object DateTimeField2: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object DateTimeField3: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object SmallintField1: TSmallintField
      FieldName = 'EXPORTADO'
    end
    object StringField3: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
    object StringField4: TStringField
      FieldName = 'USUARIODIG'
    end
    object SmallintField2: TSmallintField
      FieldName = 'SITE'
    end
    object SmallintField3: TSmallintField
      FieldName = 'ESPECIAL'
    end
    object QueryComboioExp2CODROTA: TIntegerField
      FieldName = 'CODROTA'
    end
    object QueryComboioExp2CODTIPOOPERACAO: TIntegerField
      FieldName = 'CODTIPOOPERACAO'
    end
    object QueryComboioExp2CODEXTERNO: TStringField
      FieldName = 'CODEXTERNO'
    end
    object QueryComboioExp2DATAINIDESCARGA: TDateTimeField
      FieldName = 'DATAINIDESCARGA'
    end
    object QueryComboioExp2DATAFINDESCARGA: TDateTimeField
      FieldName = 'DATAFINDESCARGA'
    end
  end
  object QueryRComboioConfPeso: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.data, cb.codcomboio, cb.comboiocliente, cb.codcliente,' +
        'cli.nome as nomecliente, r.descricao as nomerastreador, '
      
        '((cidor.nome||'#39'-'#39'|| cidor.uf )||'#39' / '#39'||(cidde.nome||'#39'-'#39'|| cidde.' +
        'uf ))as cidadeorigemdestnio,'
      'v.codveiculo, v.placa, cv.peso, cv.numeroctrc, cv.notafiscal '
      
        'from Comboio cb, cliente cli, rastreador r, cidade cidor, cidade' +
        ' cidde, veiculo v, comboioveiculo cv'
      'where cb.codcliente = cli.codcliente'
      'and r.codrastreador = cv.codrastreador'
      'and cb.codorigem = cidor.codcidade'
      'and cb.coddestino = cidde.codcidade'
      'and cv.codcomboio = cb.codcomboio'
      'and cv.codveiculo = v.codveiculo')
    Params = <>
    Left = 64
    Top = 320
    object QueryRComboioConfPesoDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRComboioConfPesoCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRComboioConfPesoCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object QueryRComboioConfPesoNOMECLIENTE: TStringField
      FieldName = 'NOMECLIENTE'
      Required = True
      Size = 50
    end
    object QueryRComboioConfPesoNOMERASTREADOR: TStringField
      FieldName = 'NOMERASTREADOR'
      Size = 50
    end
    object QueryRComboioConfPesoCIDADEORIGEMDESTNIO: TStringField
      FieldName = 'CIDADEORIGEMDESTNIO'
      ReadOnly = True
      Required = True
      Size = 107
    end
    object QueryRComboioConfPesoCODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
      Required = True
    end
    object QueryRComboioConfPesoPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRComboioConfPesoPESO: TFloatField
      FieldName = 'PESO'
      DisplayFormat = '###,###'
    end
    object QueryRComboioConfPesoNUMEROCTRC: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object QueryRComboioConfPesoNOTAFISCAL: TStringField
      FieldName = 'NOTAFISCAL'
      Size = 50
    end
    object QueryRComboioConfPesoCOMBOIOCLIENTE: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
  end
  object QueryRAvaliacaoMotorista: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select av.*, v.placa, m.nome, cv.numeroctrc'
      'from avaliacao av, comboioveiculo cv, veiculo v, motorista m'
      'where v.codveiculo = cv.codveiculo'
      'and av.codcomboio = cv.codcomboio'
      'and cv.codmotorista = av.codmotorista'
      'and av.codmotorista = m.codmotorista'
      'and cv.codmotorista = m.codmotorista')
    Params = <>
    Left = 584
    Top = 40
    object QueryRAvaliacaoMotoristaCODAVALIACAO: TIntegerField
      FieldName = 'CODAVALIACAO'
      Required = True
    end
    object QueryRAvaliacaoMotoristaDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRAvaliacaoMotoristaTIPOAVALIACAO: TStringField
      FieldName = 'TIPOAVALIACAO'
      Size = 1
    end
    object QueryRAvaliacaoMotoristaCODMOTORISTA: TIntegerField
      FieldName = 'CODMOTORISTA'
    end
    object QueryRAvaliacaoMotoristaCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRAvaliacaoMotoristaPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRAvaliacaoMotoristaNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryRAvaliacaoMotoristaNUMEROCTRC: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
  end
  object QueryRContaRastreador: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cast(datainicio as date) as datainicio,cast(datafinal as ' +
        'date)as datafinal , v.placa, cli.nome, r.descricao,'
      
        '(cast(cr.datafinal as date) - cast(cr.datainicio as date)) as te' +
        'mpo'
      'from contarastreador cr, cliente cli, rastreador r, veiculo v'
      'where cr.codveiculo = v.codveiculo'
      'and cli.codcliente = cr.codcliente'
      'and cr.codrastreador = r.codrastreador')
    Params = <>
    Left = 600
    Top = 104
    object QueryRContaRastreadorPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRContaRastreadorNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRContaRastreadorDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object QueryRContaRastreadorDATAINICIO: TDateField
      FieldName = 'DATAINICIO'
      ReadOnly = True
    end
    object QueryRContaRastreadorDATAFINAL: TDateField
      FieldName = 'DATAFINAL'
      ReadOnly = True
    end
    object QueryRContaRastreadorTEMPO: TIntegerField
      FieldName = 'TEMPO'
      ReadOnly = True
    end
  end
  object QueryRAux: TZQuery
    Connection = DMprinc.ZConnection1
    Params = <>
    Left = 232
    Top = 360
  end
  object QueryRUltimaPosicao: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.codcomboio, v.placa, m.nome, r.descricao, m.celular, c' +
        'v.notafiscal, cb.previsaosaida,'
      
        '(select (cid.nome||'#39'-'#39'||cid.uf) from comboioocorrencia co, cidad' +
        'e cid'
      'where cid.codcidade = co.codcidade and co.codcomboioocorrencia ='
      '(select max(co2.codcomboioocorrencia) from comboioocorrencia co2'
      'where co2.codcomboio = cb.codcomboio)) as cidadeatual,'
      '(select co.data from comboioocorrencia co'
      'where co.codcomboioocorrencia ='
      '(select max(co2.codcomboioocorrencia) from comboioocorrencia co2'
      'where co2.codcomboio = cb.codcomboio)) as dataOcorrencia,'
      '(select o.descricao from comboioocorrencia co, ocorrencia o'
      'where co.codocorrencia = o.codocorrencia'
      'and co.codcomboioocorrencia ='
      '(select max(co2.codcomboioocorrencia) from comboioocorrencia co2'
      'where co2.codcomboio = cb.codcomboio)) as Ocorrencia'
      
        'from comboio cb, veiculo v, motorista m, rastreador r, comboiove' +
        'iculo cv'
      'where cb.codcomboio = cv.codcomboio'
      'and m.codmotorista = cv.codmotorista'
      'and cv.codveiculo = v.codveiculo'
      'and cv.codrastreador = r.codrastreador'
      'and cb.datachegada is null'
      '')
    Params = <>
    Left = 344
    Top = 336
    object QueryRUltimaPosicaoCODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRUltimaPosicaoPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRUltimaPosicaoNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryRUltimaPosicaoDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object QueryRUltimaPosicaoCELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRUltimaPosicaoNOTAFISCAL: TStringField
      FieldName = 'NOTAFISCAL'
      Size = 50
    end
    object QueryRUltimaPosicaoPREVISAOSAIDA: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object QueryRUltimaPosicaoDATAOCORRENCIA: TDateTimeField
      FieldName = 'DATAOCORRENCIA'
      ReadOnly = True
    end
    object QueryRUltimaPosicaoOCORRENCIA: TStringField
      FieldName = 'OCORRENCIA'
      ReadOnly = True
      Size = 100
    end
    object QueryRUltimaPosicaoCIDADEATUAL: TStringField
      FieldName = 'CIDADEATUAL'
      ReadOnly = True
      Size = 53
    end
  end
  object QueryREnvioNCV: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select c1.NOME ||'#39'-'#39'|| c1.UF as cidadeuf'
      '     , m1.NOME'
      '     , o1.DESCRICAO'
      '     , v1.PLACA'
      '     , c2.NOME||'#39'-'#39'||c2.UF AS ORIGEM'
      '     , c3.NOME||'#39'-'#39'||c3.UF AS DESTINO'
      '     , CB.DATA'
      'from ANOMALIA a1'
      '      inner join COMBOIO cb ON a1.CODCOMBOIO = cb.CODCOMBOIO'
      '      inner join CIDADE c2 ON cb.CODORIGEM = c2.CODCIDADE'
      '      inner join CIDADE c3 ON cb.CODDESTINO = c3.CODCIDADE'
      '      inner join CIDADE c1 ON a1.CODCIDADE = c1.CODCIDADE'
      
        '      inner join MOTORISTA m1 ON m1.CODMOTORISTA = a1.CODMOTORIS' +
        'TA'
      
        '      inner join OCORRENCIA o1 ON a1.CODOCORRENCIA = o1.CODOCORR' +
        'ENCIA'
      '      inner join VEICULO v1 ON a1.CODVEICULO = v1.CODVEICULO'
      'where a1.codanomalia = :pcodanomalia')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodanomalia'
        ParamType = ptUnknown
      end>
    Left = 448
    Top = 360
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodanomalia'
        ParamType = ptUnknown
      end>
    object QueryREnvioNCVNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryREnvioNCVDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 100
    end
    object QueryREnvioNCVPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryREnvioNCVCIDADEUF: TStringField
      FieldName = 'CIDADEUF'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object QueryREnvioNCVORIGEM: TStringField
      FieldName = 'ORIGEM'
      ReadOnly = True
      Size = 53
    end
    object QueryREnvioNCVDESTINO: TStringField
      FieldName = 'DESTINO'
      ReadOnly = True
      Size = 53
    end
    object QueryREnvioNCVDATA: TDateField
      FieldName = 'DATA'
    end
  end
  object QueryRResumoOperacional: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select count(*)as quantidade,'#39'VIAGENS'#39' as descricao'
      
        'from comboio comb, cliente cli where comb.codcliente = cli.codcl' +
        'iente'
      'and cli.codcliente = :pcodcliente'
      'and extract(month from comb.data) = :pmes'
      'and extract(year from comb.data) = :pano'
      'union'
      'select count(*)as quantidade,'#39'NCV'#39' as descricao'
      
        'from anomalia ncv, cliente cli, veiculo vei where vei.codcliente' +
        ' = cli.codcliente'
      'and vei.codveiculo = ncv.codveiculo'
      'and cli.codcliente = :pcodcliente'
      'and extract(month from ncv.datastart) = :pmes'
      'and extract(year from ncv.datastart) = :pano'
      'union'
      'select sum(cv.peso)as quantidade,'#39'VOLUME'#39' as descricao'
      
        'from comboio comb, cliente cli, comboioveiculo cv where comb.cod' +
        'cliente = cli.codcliente'
      'and cv.codcomboio = comb.codcomboio'
      'and cli.codcliente = :pcodcliente'
      'and extract(month from comb.data) = :pmes'
      'and extract(year from comb.data) = :pano'
      'union'
      'select sum(cv.km)as quantidade,'#39'KM'#39' as descricao'
      
        'from comboio comb, cliente cli, comboioveiculo cv where comb.cod' +
        'cliente = cli.codcliente'
      'and cv.codcomboio = comb.codcomboio'
      'and cli.codcliente = :pcodcliente'
      'and extract(month from comb.data) = :pmes'
      'and extract(year from comb.data) = :pano'
      '')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodcliente'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pmes'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pano'
        ParamType = ptUnknown
      end>
    Left = 552
    Top = 376
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodcliente'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pmes'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pano'
        ParamType = ptUnknown
      end>
    object QueryRResumoOperacionalQUANTIDADE: TFloatField
      FieldName = 'QUANTIDADE'
      ReadOnly = True
      DisplayFormat = '###,###'
    end
    object QueryRResumoOperacionalDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      ReadOnly = True
      Required = True
      Size = 7
    end
  end
  object QueryRGraficoAnomalia: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select count(*) as quantidade, ncv.codocorrencia from anomalia n' +
        'cv, veiculo vei, ocorrencia oc'
      'where vei.codveiculo = ncv.codveiculo'
      'and oc.codocorrencia = ncv.codocorrencia'
      'and vei.codcliente = :pcodcliente'
      'and extract(month from ncv.datastart) = :pmes'
      'and extract(year from ncv.datastart) = :pano'
      'group by ncv.codocorrencia')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodcliente'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pmes'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pano'
        ParamType = ptUnknown
      end>
    Left = 632
    Top = 360
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodcliente'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pmes'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'pano'
        ParamType = ptUnknown
      end>
  end
  object QueryRComboio2: TZQuery
    Connection = DMprinc.ZConnection1
    AfterOpen = QueryRComboioAfterOpen
    SQL.Strings = (
      
        'select v.codcarreta1, v.codcarreta2, v.codcarreta3, v.codveiculo' +
        ', v.renavam, v.Placa, cidveiculo.nome ||'#39' - '#39'|| cidveiculo.uf as' +
        ' cidadeufvei, cr.descricao as corveiculo, c.comboiocliente, merc' +
        '.descricao as descmercadoria, c.previsaosaida, c.previsaochegada' +
        ','
      
        'v.anomod, tv.descricao as tipoveiculo , v.chassi, mar.descricao ' +
        '||'#39' / '#39'|| mod.descricao as marcamodelo,'
      
        'm.dataliberacao, m.nome as motorista, m.rg, m.cpf, m.validadecnh' +
        ' ||'#39' / '#39'|| m.cnh as cnhvalidade, m.celular, m.fone1, m.fone2, m.' +
        'endereco as endmot, m.datanascimento, m.complemento, cidmotorist' +
        'a.nome ||'#39' - '#39'|| cidmotorista.uf as cidadeufmotorista, m.bairro,' +
        ' cv.consultamotorista,'
      
        'c.codcomboio, c.data ,c.kmprevisto, r.descricao as rastreador, r' +
        '.fixo, r.numero, clie.nome as cliente, clie.contato, clie.fone a' +
        's fonecli, clie.celular as celularcli, clie.email,'
      
        'cv.notafiscal, cv.valornf, cv.numeroctrc, cv.obs, v.limitepeso, ' +
        'carr.placa as carreta1, cv.mct, cv.codcomboioveiculo, cv.peso,'
      
        'carr.cidadeuf as cidadeufcarreta1, carr.cor as corcarreta1, carr' +
        '.ano as anocarr1, carr.tipo as tipocarreta1,'
      
        'ciddest.nome ||'#39' - '#39'|| ciddest.uf as cidadeufdest, cidor.nome ||' +
        #39' - '#39'|| cidor.uf as cidadeufor, clie.senhacomunicacao'
      
        'from cidade cidmotorista, mercadoria merc , comboioveiculo cv,co' +
        'mboio c , rastreador r, motorista m, cliente clie, cidade cidor,' +
        ' cidade ciddest,'
      
        'veiculo v left outer join tipoveiculo tv on (v.codtipoveiculo = ' +
        'tv.codtipoveiculo)'
      
        '          left outer join cidade cidveiculo on (cidveiculo.codci' +
        'dade = v.codcidade)'
      '          left outer join cor cr on (cr.codcor =  v.codcor)'
      
        '          left outer join modelo mod on(mod.codmodelo = v.codmod' +
        'elo)'
      
        '          left outer join marca mar on (mar.codmarca = v.codmarc' +
        'a)'
      
        '          left outer join carreta carr on (v.codcarreta1 = carr.' +
        'codveiculo)'
      
        'where c.codcomboio = cv.codcomboio and v.codveiculo = cv.codveic' +
        'ulo'
      
        'and m.codmotorista = cv.codmotorista and c.codcomboio = :pcodcom' +
        'boio'
      'and c.codcliente = clie.codcliente'
      'and c.codrastreador = r.codrastreador'
      '/*and cv.codrastreador = r.codrastreador*/'
      'and c.codorigem = cidor.codcidade'
      'and c.coddestino = ciddest.codcidade'
      'and cv.codmercadoria = merc.codmercadoria'
      'and cidmotorista.codcidade = m.codcidade'
      'order by r.codrastreador desc')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodcomboio'
        ParamType = ptUnknown
      end>
    Left = 632
    Top = 216
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodcomboio'
        ParamType = ptUnknown
      end>
    object QueryRComboio2PLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRComboio2CIDADEUFVEI: TStringField
      FieldName = 'CIDADEUFVEI'
      ReadOnly = True
      Size = 55
    end
    object QueryRComboio2CORVEICULO: TStringField
      FieldName = 'CORVEICULO'
    end
    object QueryRComboio2COMBOIOCLIENTE: TStringField
      FieldName = 'COMBOIOCLIENTE'
    end
    object QueryRComboio2DESCMERCADORIA: TStringField
      FieldName = 'DESCMERCADORIA'
      Size = 50
    end
    object QueryRComboio2ANOMOD: TSmallintField
      FieldName = 'ANOMOD'
    end
    object QueryRComboio2TIPOVEICULO: TStringField
      FieldName = 'TIPOVEICULO'
      Size = 50
    end
    object QueryRComboio2CHASSI: TStringField
      FieldName = 'CHASSI'
      Size = 50
    end
    object QueryRComboio2MARCAMODELO: TStringField
      FieldName = 'MARCAMODELO'
      ReadOnly = True
      Size = 73
    end
    object QueryRComboio2DATALIBERACAO: TDateField
      FieldName = 'DATALIBERACAO'
    end
    object QueryRComboio2MOTORISTA: TStringField
      FieldName = 'MOTORISTA'
      Size = 50
    end
    object QueryRComboio2RG: TStringField
      FieldName = 'RG'
    end
    object QueryRComboio2CPF: TStringField
      FieldName = 'CPF'
    end
    object QueryRComboio2CNHVALIDADE: TStringField
      FieldName = 'CNHVALIDADE'
      ReadOnly = True
      Size = 33
    end
    object QueryRComboio2CELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRComboio2FONE1: TStringField
      FieldName = 'FONE1'
      Size = 12
    end
    object QueryRComboio2CODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object QueryRComboio2DATA: TDateField
      FieldName = 'DATA'
    end
    object QueryRComboio2KMPREVISTO: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object QueryRComboio2RASTREADOR: TStringField
      FieldName = 'RASTREADOR'
      Size = 50
    end
    object QueryRComboio2FIXO: TSmallintField
      FieldName = 'FIXO'
    end
    object QueryRComboio2NUMERO: TStringField
      FieldName = 'NUMERO'
    end
    object QueryRComboio2CLIENTE: TStringField
      FieldName = 'CLIENTE'
      Required = True
      Size = 50
    end
    object QueryRComboio2CONTATO: TStringField
      FieldName = 'CONTATO'
      Size = 50
    end
    object QueryRComboio2FONECLI: TStringField
      FieldName = 'FONECLI'
      Size = 12
    end
    object QueryRComboio2CELULARCLI: TStringField
      FieldName = 'CELULARCLI'
      Size = 12
    end
    object QueryRComboio2EMAIL: TStringField
      FieldName = 'EMAIL'
      Size = 50
    end
    object QueryRComboio2NOTAFISCAL: TStringField
      FieldName = 'NOTAFISCAL'
      Size = 50
    end
    object QueryRComboio2VALORNF: TFloatField
      FieldName = 'VALORNF'
    end
    object QueryRComboio2NUMEROCTRC: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object QueryRComboio2OBS: TStringField
      FieldName = 'OBS'
      Size = 100
    end
    object QueryRComboio2LIMITEPESO: TIntegerField
      FieldName = 'LIMITEPESO'
    end
    object QueryRComboio2CARRETA1: TStringField
      FieldName = 'CARRETA1'
      Size = 8
    end
    object QueryRComboio2MCT: TStringField
      FieldName = 'MCT'
      Size = 50
    end
    object QueryRComboio2CODCOMBOIOVEICULO: TIntegerField
      FieldName = 'CODCOMBOIOVEICULO'
      Required = True
    end
    object QueryRComboio2CIDADEUFCARRETA1: TStringField
      FieldName = 'CIDADEUFCARRETA1'
      Size = 55
    end
    object QueryRComboio2CORCARRETA1: TStringField
      FieldName = 'CORCARRETA1'
    end
    object QueryRComboio2ANOCARR1: TSmallintField
      FieldName = 'ANOCARR1'
    end
    object QueryRComboio2TIPOCARRETA1: TStringField
      FieldName = 'TIPOCARRETA1'
      Size = 50
    end
    object QueryRComboio2CIDADEUFDEST: TStringField
      FieldName = 'CIDADEUFDEST'
      ReadOnly = True
      Size = 55
    end
    object QueryRComboio2CIDADEUFOR: TStringField
      FieldName = 'CIDADEUFOR'
      ReadOnly = True
      Size = 55
    end
    object QueryRComboio2RENAVAM: TStringField
      FieldName = 'RENAVAM'
      Size = 50
    end
    object QueryRComboio2CODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
      Required = True
    end
    object QueryRComboio2FONE2: TStringField
      FieldName = 'FONE2'
      Size = 12
    end
    object QueryRComboio2ENDMOT: TStringField
      FieldName = 'ENDMOT'
      Size = 100
    end
    object QueryRComboio2DATANASCIMENTO: TDateField
      FieldName = 'DATANASCIMENTO'
    end
    object QueryRComboio2COMPLEMENTO: TStringField
      FieldName = 'COMPLEMENTO'
      Size = 100
    end
    object QueryRComboio2CIDADEUFMOTORISTA: TStringField
      FieldName = 'CIDADEUFMOTORISTA'
      ReadOnly = True
      Size = 55
    end
    object QueryRComboio2BAIRRO: TStringField
      FieldName = 'BAIRRO'
    end
    object QueryRComboio2PESO: TFloatField
      FieldName = 'PESO'
    end
    object QueryRComboio2PREVISAOSAIDA: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object QueryRComboio2PREVISAOCHEGADA: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object QueryRComboio2CODCARRETA1: TIntegerField
      FieldName = 'CODCARRETA1'
    end
    object QueryRComboio2CODCARRETA2: TIntegerField
      FieldName = 'CODCARRETA2'
    end
    object QueryRComboio2CODCARRETA3: TIntegerField
      FieldName = 'CODCARRETA3'
    end
    object QueryRComboio2CONSULTAMOTORISTA: TStringField
      FieldName = 'CONSULTAMOTORISTA'
    end
    object QueryRComboio2SENHACOMUNICACAO: TStringField
      FieldName = 'SENHACOMUNICACAO'
    end
  end
  object QueryRComboioItensSeg: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select ds.descricao from dispositivoseguranca ds, itemseguranca ' +
        'i'
      'where i.coddispositivoseguranca = ds.coddispositivoseguranca'
      'and i.codveiculo = :pcod')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcod'
        ParamType = ptUnknown
      end>
    Left = 136
    Top = 376
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcod'
        ParamType = ptUnknown
      end>
  end
  object QueryRRotaComboio: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select c1.NOME||'#39'-'#39'||c1.UF as descricao'
      'from CIDADE c1'
      '      inner join DESTINO d1 ON c1.CODCIDADE = d1.CODCIDADE'
      'where d1.codrota = :pcodrota')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodrota'
        ParamType = ptUnknown
      end>
    Left = 632
    Top = 272
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodrota'
        ParamType = ptUnknown
      end>
    object QueryRRotaComboioDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      ReadOnly = True
      Size = 53
    end
  end
  object QueryRFatura3: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.codcomboio, cb.data, cb.codcliente, cv.quantidade, cv.' +
        'peso, cv.numeroctrc, v.placa, r.descricao, r.numero, r.telemonit' +
        'orado, f.DATAEMISSAO, (cv.valortotal) as valor,'
      
        'cast((cb.datachegada - cb.previsaosaida)*24 as numeric (14,0)) a' +
        's tempo,'
      
        'origem.nome||'#39' - '#39'||origem.uf as cidorigem, destino.nome||'#39' - '#39'|' +
        '|destino.uf as ciddestino, f.obs1,'
      
        'cb.kmprevisto, cv.km, cb.codfatura, cli.nome, cli.endereco, cli.' +
        'cnpj, cli.ie, (cidcli.nome||'#39'-'#39'||cidcli.uf)as cidadecli, f.datai' +
        'nicio, f.datafim, f.desconto, (f.valortotal - f.desconto) as val' +
        'ortotal,'
      
        'cb.PREVISAOSAIDA, cb.PREVISAOCHEGADA, cb.DATACHEGADA, mot.nome a' +
        's nomemot, cv.mct'
      
        'from comboio cb, comboioveiculo cv, rastreador r, cidade origem,' +
        ' cidade destino, veiculo v, fatura f, cliente cli, cidade cidcli' +
        ', motorista mot'
      'where cb.codcomboio = cv.codcomboio'
      'and cb.codorigem = origem.codcidade'
      'and cb.coddestino = destino.codcidade'
      'and cv.codveiculo = v.codveiculo'
      'and cb.codfatura = :pcodfatura'
      'and cv.codrastreador = r.codrastreador'
      'and f.codfatura = cb.codfatura'
      'and f.codcliente = cli.codcliente'
      'and cidcli.codcidade = cli.codcidade'
      'and mot.codmotorista = cv.codmotorista'
      'order by cb.codcomboio')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    Left = 344
    Top = 392
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    object IntegerField11: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object StringField5: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object StringField6: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object StringField7: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object StringField8: TStringField
      FieldName = 'NUMERO'
    end
    object StringField9: TStringField
      FieldName = 'CIDORIGEM'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object StringField10: TStringField
      FieldName = 'CIDDESTINO'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object IntegerField12: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object IntegerField13: TIntegerField
      FieldName = 'KM'
    end
    object FloatField5: TFloatField
      FieldName = 'VALORTOTAL'
      ReadOnly = True
      currency = True
    end
    object IntegerField14: TIntegerField
      FieldName = 'CODFATURA'
    end
    object DateField4: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object FloatField6: TFloatField
      FieldName = 'VALOR'
      ReadOnly = True
      currency = True
    end
    object StringField11: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object StringField12: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object StringField13: TStringField
      FieldName = 'CNPJ'
    end
    object StringField14: TStringField
      FieldName = 'IE'
    end
    object StringField15: TStringField
      FieldName = 'CIDADECLI'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object StringField16: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object DateField5: TDateField
      FieldName = 'DATAINICIO'
    end
    object DateField6: TDateField
      FieldName = 'DATAFIM'
    end
    object IntegerField15: TIntegerField
      FieldName = 'QUANTIDADE'
    end
    object FloatField7: TFloatField
      FieldName = 'PESO'
      DisplayFormat = '###,###,###'
      EditFormat = '###,###,###'
    end
    object SmallintField4: TSmallintField
      FieldName = 'TELEMONITORADO'
    end
    object FloatField8: TFloatField
      FieldName = 'DESCONTO'
      currency = True
    end
    object DateField7: TDateField
      FieldName = 'DATA'
    end
    object IntegerField16: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object QueryRFatura3PREVISAOSAIDA: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object QueryRFatura3PREVISAOCHEGADA: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object QueryRFatura3DATACHEGADA: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object QueryRFatura3NOMEMOT: TStringField
      FieldName = 'NOMEMOT'
      Size = 50
    end
    object QueryRFatura3TEMPO: TLargeintField
      FieldName = 'TEMPO'
      ReadOnly = True
    end
    object QueryRFatura3MCT: TStringField
      FieldName = 'MCT'
      Size = 50
    end
  end
  object QueryRFaturaContaRastreador: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select m1.CPF'
      '     , m1.NOME as nomemotorista'
      '     , c1.DATAINICIO'
      '     , c1.DATAFINAL'
      '     , c2.NOME  as nomecliente'
      '     , c2.FONE'
      '     , c2.CNPJ'
      '     , c2.ENDERECO'
      '     , c2.IE'
      '     , c2.CELULAR'
      '     , c2.FAX'
      '     , c2.VALORDIARIACONTA'
      '     , (c1.VALORTOTAL / c2.VALORDIARIACONTA) as DIASCONTA'
      '     , c1.VALORTOTAL as valorconta'
      '     , c2.CONTATO'
      '     , f1.VALORTOTAL as valorfatura'
      '     , f1.DATAEMISSAO'
      '     , f1.DATAVENCIMENTO'
      '     , r1.DESCRICAO AS rastreador1'
      '     ,v1.*'
      '     ,f1.CODFATURA'
      '     ,f1.DATAINICIO as datainifat'
      '     ,f1.DATAFIM as datafimfat'
      '     ,c3.nome||'#39'-'#39'||c3.uf as cidadeufcli'
      'from FATURA f1'
      '      inner join CLIENTE c2 ON c2.CODCLIENTE = f1.CODCLIENTE'
      '      inner join CIDADE c3 ON c3.CODCIDADE = c2.CODCIDADE'
      
        '      inner join CONTARASTREADOR c1 ON c1.CODFATURA = f1.CODFATU' +
        'RA'
      
        '      inner join VEICULOCOMPLETO v1 ON c1.CODVEICULO = v1.CODVEI' +
        'CULO'
      
        '      inner join MOTORISTA m1 ON v1.CODMOTORISTA = m1.CODMOTORIS' +
        'TA'
      
        '      inner join RASTREADOR r1 ON c1.CODRASTREADOR = r1.CODRASTR' +
        'EADOR'
      'and f1.codfatura = :pcodfatura ')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    Left = 552
    Top = 200
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    object QueryRFaturaContaRastreadorCPF: TStringField
      FieldName = 'CPF'
    end
    object QueryRFaturaContaRastreadorNOMEMOTORISTA: TStringField
      FieldName = 'NOMEMOTORISTA'
      Size = 50
    end
    object QueryRFaturaContaRastreadorDATAINICIO: TDateTimeField
      FieldName = 'DATAINICIO'
    end
    object QueryRFaturaContaRastreadorDATAFINAL: TDateTimeField
      FieldName = 'DATAFINAL'
    end
    object QueryRFaturaContaRastreadorNOMECLIENTE: TStringField
      FieldName = 'NOMECLIENTE'
      Required = True
      Size = 50
    end
    object QueryRFaturaContaRastreadorFONE: TStringField
      FieldName = 'FONE'
      Size = 12
    end
    object QueryRFaturaContaRastreadorCNPJ: TStringField
      FieldName = 'CNPJ'
    end
    object QueryRFaturaContaRastreadorCELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRFaturaContaRastreadorFAX: TStringField
      FieldName = 'FAX'
      Size = 12
    end
    object QueryRFaturaContaRastreadorVALORCONTA: TFloatField
      FieldName = 'VALORCONTA'
      DisplayFormat = '###,###.00'
    end
    object QueryRFaturaContaRastreadorCONTATO: TStringField
      FieldName = 'CONTATO'
      Size = 50
    end
    object QueryRFaturaContaRastreadorVALORFATURA: TFloatField
      FieldName = 'VALORFATURA'
      DisplayFormat = '###,###.00'
    end
    object QueryRFaturaContaRastreadorDATAEMISSAO: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object QueryRFaturaContaRastreadorDATAVENCIMENTO: TDateField
      FieldName = 'DATAVENCIMENTO'
    end
    object QueryRFaturaContaRastreadorRASTREADOR1: TStringField
      FieldName = 'RASTREADOR1'
      Size = 50
    end
    object QueryRFaturaContaRastreadorCODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
    end
    object QueryRFaturaContaRastreadorPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRFaturaContaRastreadorRENAVAM: TStringField
      FieldName = 'RENAVAM'
      Size = 50
    end
    object QueryRFaturaContaRastreadorCHASSI: TStringField
      FieldName = 'CHASSI'
      Size = 50
    end
    object QueryRFaturaContaRastreadorANOFAB: TSmallintField
      FieldName = 'ANOFAB'
    end
    object QueryRFaturaContaRastreadorANOMOD: TSmallintField
      FieldName = 'ANOMOD'
    end
    object QueryRFaturaContaRastreadorCORVEICULO: TStringField
      FieldName = 'CORVEICULO'
    end
    object QueryRFaturaContaRastreadorMARCAVEICULO: TStringField
      FieldName = 'MARCAVEICULO'
      Size = 50
    end
    object QueryRFaturaContaRastreadorMODELOVEICULO: TStringField
      FieldName = 'MODELOVEICULO'
    end
    object QueryRFaturaContaRastreadorCIDADEUFVEICULO: TStringField
      FieldName = 'CIDADEUFVEICULO'
      Size = 53
    end
    object QueryRFaturaContaRastreadorTIPOVEICULO: TStringField
      FieldName = 'TIPOVEICULO'
      Size = 50
    end
    object QueryRFaturaContaRastreadorRASTREADOR: TStringField
      FieldName = 'RASTREADOR'
      Size = 50
    end
    object QueryRFaturaContaRastreadorCODMOTORISTA: TIntegerField
      FieldName = 'CODMOTORISTA'
    end
    object QueryRFaturaContaRastreadorVALORDIARIACONTA: TFloatField
      FieldName = 'VALORDIARIACONTA'
      DisplayFormat = '###,###.00'
    end
    object QueryRFaturaContaRastreadorDIASCONTA: TFloatField
      FieldName = 'DIASCONTA'
      ReadOnly = True
    end
    object QueryRFaturaContaRastreadorCODFATURA: TIntegerField
      FieldName = 'CODFATURA'
      Required = True
    end
    object QueryRFaturaContaRastreadorDATAINIFAT: TDateField
      FieldName = 'DATAINIFAT'
    end
    object QueryRFaturaContaRastreadorDATAFIMFAT: TDateField
      FieldName = 'DATAFIMFAT'
    end
    object QueryRFaturaContaRastreadorCIDADEUFCLI: TStringField
      FieldName = 'CIDADEUFCLI'
      ReadOnly = True
      Size = 53
    end
    object QueryRFaturaContaRastreadorENDERECO: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object QueryRFaturaContaRastreadorIE: TStringField
      FieldName = 'IE'
    end
  end
  object QueryRCombOcorrConf2: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select co.codcomboio, oc.descricao as ocorrencia, co.data, v.pla' +
        'ca, l.descricao as local, cid.nome||'#39'-'#39'||cid.uf as cidadeuf, co.' +
        'usuariodig'
      'from comboioocorrencia co'
      'inner join veiculo v on (v.codveiculo = co.codveiculo)'
      'inner join comboio cb on (cb.codcomboio = co.codcomboio)'
      'inner join local l on (l.codlocal = co.codlocal)'
      'inner join cidade cid on (cid.codcidade = co.codcidade)'
      
        'inner join ocorrencia oc on (co.codocorrencia = oc.codocorrencia' +
        ')'
      'where cb.datachegada is null'
      'and co.data ='
      
        '(select max(co2.data) from comboioocorrencia co2 where co2.codco' +
        'mboio = cb.codcomboio )')
    Params = <>
    Left = 656
    Top = 16
    object QueryRCombOcorrConf2CODCOMBOIO: TIntegerField
      FieldName = 'CODCOMBOIO'
    end
    object QueryRCombOcorrConf2OCORRENCIA: TStringField
      FieldName = 'OCORRENCIA'
      Size = 100
    end
    object QueryRCombOcorrConf2DATA: TDateTimeField
      FieldName = 'DATA'
    end
    object QueryRCombOcorrConf2PLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRCombOcorrConf2LOCAL: TStringField
      FieldName = 'LOCAL'
      Size = 50
    end
    object QueryRCombOcorrConf2CIDADEUF: TStringField
      FieldName = 'CIDADEUF'
      ReadOnly = True
      Size = 53
    end
    object QueryRCombOcorrConf2USUARIODIG: TStringField
      FieldName = 'USUARIODIG'
    end
  end
  object QueryRFaturamento2: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select cb.codcomboio, cb.data, cb.codcliente, cv.quantidade, cv.' +
        'peso, cv.numeroctrc, v.placa, r.descricao, r.numero, r.telemonit' +
        'orado, f.DATAEMISSAO, (cv.valortotal) as valor,'
      
        'cast((cb.datachegada - cb.previsaosaida)*24 as numeric (14,0)) a' +
        's tempo,'
      
        'origem.nome||'#39' - '#39'||origem.uf as cidorigem, destino.nome||'#39' - '#39'|' +
        '|destino.uf as ciddestino, f.obs1,'
      
        'cb.kmprevisto, cv.km, cb.codfatura, cli.nome, cli.endereco, cli.' +
        'cnpj, cli.ie, (cidcli.nome||'#39'-'#39'||cidcli.uf)as cidadecli, f.datai' +
        'nicio, f.datafim, f.desconto, (f.valortotal - f.desconto) as val' +
        'ortotal,'
      
        'cb.PREVISAOSAIDA, cb.PREVISAOCHEGADA, cb.DATACHEGADA, mot.nome a' +
        's nomemot, cv.mct'
      
        'from comboio cb, comboioveiculo cv, rastreador r, cidade origem,' +
        ' cidade destino, veiculo v, fatura f, cliente cli, cidade cidcli' +
        ', motorista mot'
      'where cb.codcomboio = cv.codcomboio'
      'and cb.codorigem = origem.codcidade'
      'and cb.coddestino = destino.codcidade'
      'and cv.codveiculo = v.codveiculo'
      'and cv.codrastreador = r.codrastreador'
      'and f.codfatura = cb.codfatura'
      'and f.codcliente = cli.codcliente'
      'and cidcli.codcidade = cli.codcidade'
      'and mot.codmotorista = cv.codmotorista')
    Params = <>
    Left = 272
    Top = 408
    object IntegerField17: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object StringField17: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object StringField18: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object StringField19: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object StringField20: TStringField
      FieldName = 'NUMERO'
    end
    object StringField21: TStringField
      FieldName = 'CIDORIGEM'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object StringField22: TStringField
      FieldName = 'CIDDESTINO'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object IntegerField18: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object IntegerField19: TIntegerField
      FieldName = 'KM'
    end
    object FloatField9: TFloatField
      FieldName = 'VALORTOTAL'
      ReadOnly = True
      currency = True
    end
    object IntegerField20: TIntegerField
      FieldName = 'CODFATURA'
    end
    object DateField8: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object FloatField10: TFloatField
      FieldName = 'VALOR'
      ReadOnly = True
      currency = True
    end
    object StringField23: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object StringField24: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object StringField25: TStringField
      FieldName = 'CNPJ'
    end
    object StringField26: TStringField
      FieldName = 'IE'
    end
    object StringField27: TStringField
      FieldName = 'CIDADECLI'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object StringField28: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object DateField9: TDateField
      FieldName = 'DATAINICIO'
    end
    object DateField10: TDateField
      FieldName = 'DATAFIM'
    end
    object IntegerField21: TIntegerField
      FieldName = 'QUANTIDADE'
    end
    object FloatField11: TFloatField
      FieldName = 'PESO'
      DisplayFormat = '###,###,###'
      EditFormat = '###,###,###'
    end
    object SmallintField5: TSmallintField
      FieldName = 'TELEMONITORADO'
    end
    object FloatField12: TFloatField
      FieldName = 'DESCONTO'
      currency = True
    end
    object DateField11: TDateField
      FieldName = 'DATA'
    end
    object IntegerField22: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object DateTimeField4: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object DateTimeField5: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object DateTimeField6: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object StringField29: TStringField
      FieldName = 'NOMEMOT'
      Size = 50
    end
    object LargeintField1: TLargeintField
      FieldName = 'TEMPO'
      ReadOnly = True
    end
    object StringField30: TStringField
      FieldName = 'MCT'
      Size = 50
    end
  end
  object QueryRCavaloCarretaComp: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select cav.*,'
      'c1.placa as placacarreta1,'
      'c1.renavam as renavamcarreta1,'
      'c1.chassi as chassicarreta1,'
      'c1.anofab as anofabcarreta1,'
      'c1.anomod as anomodcarreta1,'
      'c1.corveiculo as corcarreta1,'
      'c1.marcaveiculo as marcacarreta1,'
      'c1.modeloveiculo as modelocarreta1,'
      'c1.cidadeufveiculo as cidadeufcarreta1,'
      'c1.tipoveiculo as tipocarreta1,'
      ''
      'c2.placa as placacarreta2,'
      'c2.renavam as renavamcarreta2,'
      'c2.chassi as chassicarreta2,'
      'c2.anofab as anofabcarreta2,'
      'c2.anomod as anomodcarreta2,'
      'c2.corveiculo as corcarreta2,'
      'c2.marcaveiculo as marcacarreta2,'
      'c2.modeloveiculo as modelocarreta2,'
      'c2.cidadeufveiculo as cidadeufcarreta2,'
      'c2.tipoveiculo as tipocarreta2,'
      ''
      'c3.placa as placacarreta3,'
      'c3.renavam as renavamcarreta3,'
      'c3.chassi as chassicarreta3,'
      'c3.anofab as anofabcarreta3,'
      'c3.anomod as anomodcarreta3,'
      'c3.corveiculo as corcarreta3,'
      'c3.marcaveiculo as marcacarreta3,'
      'c3.modeloveiculo as modelocarreta3,'
      'c3.cidadeufveiculo as cidadeufcarreta3,'
      'c3.tipoveiculo as tipocarreta3,'
      ''
      'mot.nome,'
      'mot.fone1,'
      'mot.celular,'
      'mot.cpf'
      ''
      'from veiculocompleto cav'
      
        'left outer join veiculocompleto c1 on(cav.codcarreta1 = c1.codve' +
        'iculo)'
      
        'left outer join veiculocompleto c2 on(cav.codcarreta2 = c2.codve' +
        'iculo)'
      
        'left outer join veiculocompleto c3 on(cav.codcarreta3 = c3.codve' +
        'iculo)'
      
        'left outer join motorista mot on (cav.codmotorista = mot.codmoto' +
        'rista) '
      'where cav.codveiculo > 0')
    Params = <>
    Left = 40
    Top = 392
    object QueryRCavaloCarretaCompCODVEICULO: TIntegerField
      FieldName = 'CODVEICULO'
    end
    object QueryRCavaloCarretaCompPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRCavaloCarretaCompRENAVAM: TStringField
      FieldName = 'RENAVAM'
      Size = 50
    end
    object QueryRCavaloCarretaCompCHASSI: TStringField
      FieldName = 'CHASSI'
      Size = 50
    end
    object QueryRCavaloCarretaCompANOFAB: TSmallintField
      FieldName = 'ANOFAB'
    end
    object QueryRCavaloCarretaCompANOMOD: TSmallintField
      FieldName = 'ANOMOD'
    end
    object QueryRCavaloCarretaCompCORVEICULO: TStringField
      FieldName = 'CORVEICULO'
    end
    object QueryRCavaloCarretaCompMARCAVEICULO: TStringField
      FieldName = 'MARCAVEICULO'
      Size = 50
    end
    object QueryRCavaloCarretaCompMODELOVEICULO: TStringField
      FieldName = 'MODELOVEICULO'
    end
    object QueryRCavaloCarretaCompCIDADEUFVEICULO: TStringField
      FieldName = 'CIDADEUFVEICULO'
      Size = 53
    end
    object QueryRCavaloCarretaCompTIPOVEICULO: TStringField
      FieldName = 'TIPOVEICULO'
      Size = 50
    end
    object QueryRCavaloCarretaCompRASTREADOR: TStringField
      FieldName = 'RASTREADOR'
      Size = 50
    end
    object QueryRCavaloCarretaCompCODCARRETA1: TIntegerField
      FieldName = 'CODCARRETA1'
    end
    object QueryRCavaloCarretaCompCODCARRETA2: TIntegerField
      FieldName = 'CODCARRETA2'
    end
    object QueryRCavaloCarretaCompCODCARRETA3: TIntegerField
      FieldName = 'CODCARRETA3'
    end
    object QueryRCavaloCarretaCompCAVALO: TSmallintField
      FieldName = 'CAVALO'
    end
    object QueryRCavaloCarretaCompCODMOTORISTA: TIntegerField
      FieldName = 'CODMOTORISTA'
    end
    object QueryRCavaloCarretaCompPLACACARRETA1: TStringField
      FieldName = 'PLACACARRETA1'
      Size = 8
    end
    object QueryRCavaloCarretaCompRENAVAMCARRETA1: TStringField
      FieldName = 'RENAVAMCARRETA1'
      Size = 50
    end
    object QueryRCavaloCarretaCompCHASSICARRETA1: TStringField
      FieldName = 'CHASSICARRETA1'
      Size = 50
    end
    object QueryRCavaloCarretaCompANOFABCARRETA1: TSmallintField
      FieldName = 'ANOFABCARRETA1'
    end
    object QueryRCavaloCarretaCompANOMODCARRETA1: TSmallintField
      FieldName = 'ANOMODCARRETA1'
    end
    object QueryRCavaloCarretaCompCORCARRETA1: TStringField
      FieldName = 'CORCARRETA1'
    end
    object QueryRCavaloCarretaCompMARCACARRETA1: TStringField
      FieldName = 'MARCACARRETA1'
      Size = 50
    end
    object QueryRCavaloCarretaCompMODELOCARRETA1: TStringField
      FieldName = 'MODELOCARRETA1'
    end
    object QueryRCavaloCarretaCompCIDADEUFCARRETA1: TStringField
      FieldName = 'CIDADEUFCARRETA1'
      Size = 53
    end
    object QueryRCavaloCarretaCompTIPOCARRETA1: TStringField
      FieldName = 'TIPOCARRETA1'
      Size = 50
    end
    object QueryRCavaloCarretaCompPLACACARRETA2: TStringField
      FieldName = 'PLACACARRETA2'
      Size = 8
    end
    object QueryRCavaloCarretaCompRENAVAMCARRETA2: TStringField
      FieldName = 'RENAVAMCARRETA2'
      Size = 50
    end
    object QueryRCavaloCarretaCompCHASSICARRETA2: TStringField
      FieldName = 'CHASSICARRETA2'
      Size = 50
    end
    object QueryRCavaloCarretaCompANOFABCARRETA2: TSmallintField
      FieldName = 'ANOFABCARRETA2'
    end
    object QueryRCavaloCarretaCompANOMODCARRETA2: TSmallintField
      FieldName = 'ANOMODCARRETA2'
    end
    object QueryRCavaloCarretaCompCORCARRETA2: TStringField
      FieldName = 'CORCARRETA2'
    end
    object QueryRCavaloCarretaCompMARCACARRETA2: TStringField
      FieldName = 'MARCACARRETA2'
      Size = 50
    end
    object QueryRCavaloCarretaCompMODELOCARRETA2: TStringField
      FieldName = 'MODELOCARRETA2'
    end
    object QueryRCavaloCarretaCompCIDADEUFCARRETA2: TStringField
      FieldName = 'CIDADEUFCARRETA2'
      Size = 53
    end
    object QueryRCavaloCarretaCompTIPOCARRETA2: TStringField
      FieldName = 'TIPOCARRETA2'
      Size = 50
    end
    object QueryRCavaloCarretaCompPLACACARRETA3: TStringField
      FieldName = 'PLACACARRETA3'
      Size = 8
    end
    object QueryRCavaloCarretaCompRENAVAMCARRETA3: TStringField
      FieldName = 'RENAVAMCARRETA3'
      Size = 50
    end
    object QueryRCavaloCarretaCompCHASSICARRETA3: TStringField
      FieldName = 'CHASSICARRETA3'
      Size = 50
    end
    object QueryRCavaloCarretaCompANOFABCARRETA3: TSmallintField
      FieldName = 'ANOFABCARRETA3'
    end
    object QueryRCavaloCarretaCompANOMODCARRETA3: TSmallintField
      FieldName = 'ANOMODCARRETA3'
    end
    object QueryRCavaloCarretaCompCORCARRETA3: TStringField
      FieldName = 'CORCARRETA3'
    end
    object QueryRCavaloCarretaCompMARCACARRETA3: TStringField
      FieldName = 'MARCACARRETA3'
      Size = 50
    end
    object QueryRCavaloCarretaCompMODELOCARRETA3: TStringField
      FieldName = 'MODELOCARRETA3'
    end
    object QueryRCavaloCarretaCompCIDADEUFCARRETA3: TStringField
      FieldName = 'CIDADEUFCARRETA3'
      Size = 53
    end
    object QueryRCavaloCarretaCompTIPOCARRETA3: TStringField
      FieldName = 'TIPOCARRETA3'
      Size = 50
    end
    object QueryRCavaloCarretaCompCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object QueryRCavaloCarretaCompNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryRCavaloCarretaCompFONE1: TStringField
      FieldName = 'FONE1'
      Size = 12
    end
    object QueryRCavaloCarretaCompCELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRCavaloCarretaCompCPF: TStringField
      FieldName = 'CPF'
    end
  end
  object QueryRClientesAtivos: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select cli.*, cid.nome||'#39'-'#39'||cid.uf as cidadeuf'
      'from cliente cli'
      'inner join cidade cid on (cli.codcidade = cid.codcidade)'
      'where ativo = -1')
    Params = <>
    Left = 32
    Top = 256
    object QueryRClientesAtivosCODCLIENTE: TIntegerField
      FieldName = 'CODCLIENTE'
      Required = True
    end
    object QueryRClientesAtivosNOME: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object QueryRClientesAtivosCNPJ: TStringField
      FieldName = 'CNPJ'
    end
    object QueryRClientesAtivosFONE: TStringField
      FieldName = 'FONE'
      Size = 12
    end
    object QueryRClientesAtivosFAX: TStringField
      FieldName = 'FAX'
      Size = 12
    end
    object QueryRClientesAtivosCELULAR: TStringField
      FieldName = 'CELULAR'
      Size = 12
    end
    object QueryRClientesAtivosENDERECO: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object QueryRClientesAtivosBAIRRO: TStringField
      FieldName = 'BAIRRO'
    end
    object QueryRClientesAtivosCEP: TStringField
      FieldName = 'CEP'
      Size = 10
    end
    object QueryRClientesAtivosCOMPLEMENTO: TStringField
      FieldName = 'COMPLEMENTO'
      Size = 100
    end
    object QueryRClientesAtivosCODCIDADE: TIntegerField
      FieldName = 'CODCIDADE'
    end
    object QueryRClientesAtivosIE: TStringField
      FieldName = 'IE'
    end
    object QueryRClientesAtivosDELETADO: TSmallintField
      FieldName = 'DELETADO'
    end
    object QueryRClientesAtivosCODCLIENTEPRINCIPAL: TIntegerField
      FieldName = 'CODCLIENTEPRINCIPAL'
    end
    object QueryRClientesAtivosCONTATO: TStringField
      FieldName = 'CONTATO'
      Size = 50
    end
    object QueryRClientesAtivosCODUSUARIOWEB: TIntegerField
      FieldName = 'CODUSUARIOWEB'
    end
    object QueryRClientesAtivosSEGURADORA: TStringField
      FieldName = 'SEGURADORA'
    end
    object QueryRClientesAtivosCONTATOSEGURADORA: TStringField
      FieldName = 'CONTATOSEGURADORA'
      Size = 50
    end
    object QueryRClientesAtivosFONESEGURADORA: TStringField
      FieldName = 'FONESEGURADORA'
      Size = 12
    end
    object QueryRClientesAtivosSENHACOMUNICACAO: TStringField
      FieldName = 'SENHACOMUNICACAO'
    end
    object QueryRClientesAtivosEMAIL: TStringField
      FieldName = 'EMAIL'
      Size = 50
    end
    object QueryRClientesAtivosEXIGEKM: TSmallintField
      FieldName = 'EXIGEKM'
    end
    object QueryRClientesAtivosVALORVIAGEM: TFloatField
      FieldName = 'VALORVIAGEM'
    end
    object QueryRClientesAtivosAVALIACAOMOTORISTA: TSmallintField
      FieldName = 'AVALIACAOMOTORISTA'
    end
    object QueryRClientesAtivosCONTROLANCV: TSmallintField
      FieldName = 'CONTROLANCV'
    end
    object QueryRClientesAtivosLOGO: TStringField
      FieldName = 'LOGO'
      Size = 50
    end
    object QueryRClientesAtivosMONITORACARGA: TSmallintField
      FieldName = 'MONITORACARGA'
    end
    object QueryRClientesAtivosMONITORAVEICULO: TSmallintField
      FieldName = 'MONITORAVEICULO'
    end
    object QueryRClientesAtivosVALORDIARIACONTA: TFloatField
      FieldName = 'VALORDIARIACONTA'
    end
    object QueryRClientesAtivosATIVO: TSmallintField
      FieldName = 'ATIVO'
    end
    object QueryRClientesAtivosETIQUETA: TSmallintField
      FieldName = 'ETIQUETA'
    end
    object QueryRClientesAtivosCIDADEUF: TStringField
      FieldName = 'CIDADEUF'
      ReadOnly = True
      Size = 53
    end
  end
  object QueryRFatura4: TZQuery
    Connection = DMprinc.ZConnection1
    OnCalcFields = QueryRFatura4CalcFields
    SQL.Strings = (
      
        'select cb.codcomboio, cb.data, cb.hora, cb.codcliente, cv.quanti' +
        'dade, cv.peso, cv.numeroctrc, v.placa, r.descricao, r.numero, r.' +
        'telemonitorado, f.DATAEMISSAO, (cv.valortotal) as valor,'
      
        'cast((cb.datachegada - (cb.data+cb.hora))*24 as numeric (14,0)) ' +
        'as tempo,'
      
        'origem.nome||'#39' - '#39'||origem.uf as cidorigem, destino.nome||'#39' - '#39'|' +
        '|destino.uf as ciddestino, f.obs1,'
      
        'cb.kmprevisto, cv.km, cb.codfatura, cli.nome, cli.endereco, cli.' +
        'cnpj, cli.ie, (cidcli.nome||'#39'-'#39'||cidcli.uf)as cidadecli, f.datai' +
        'nicio, f.datafim, f.desconto, (f.valortotal - f.desconto) as val' +
        'ortotal,'
      
        'cb.PREVISAOSAIDA, cb.PREVISAOCHEGADA, cb.DATACHEGADA, mot.nome a' +
        's nomemot, cv.mct'
      
        'from comboio cb, comboioveiculo cv, rastreador r, cidade origem,' +
        ' cidade destino, veiculo v, fatura f, cliente cli, cidade cidcli' +
        ', motorista mot'
      'where cb.codcomboio = cv.codcomboio'
      'and cb.codorigem = origem.codcidade'
      'and cb.coddestino = destino.codcidade'
      'and cv.codveiculo = v.codveiculo'
      'and cb.codfatura = :pcodfatura'
      'and cv.codrastreador = r.codrastreador'
      'and f.codfatura = cb.codfatura'
      'and f.codcliente = cli.codcliente'
      'and cidcli.codcidade = cli.codcidade'
      'and mot.codmotorista = cv.codmotorista'
      
        'order by origem.nome||'#39' - '#39'||origem.uf||destino.nome||'#39' - '#39'||des' +
        'tino.uf')
    Params = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    Left = 432
    Top = 416
    ParamData = <
      item
        DataType = ftInteger
        Name = 'pcodfatura'
        ParamType = ptUnknown
      end>
    object IntegerField23: TIntegerField
      FieldName = 'CODCOMBOIO'
      Required = True
    end
    object StringField31: TStringField
      FieldName = 'NUMEROCTRC'
      Size = 50
    end
    object StringField32: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object StringField33: TStringField
      FieldName = 'DESCRICAO'
      Size = 50
    end
    object StringField34: TStringField
      FieldName = 'NUMERO'
    end
    object StringField35: TStringField
      FieldName = 'CIDORIGEM'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object StringField36: TStringField
      FieldName = 'CIDDESTINO'
      ReadOnly = True
      Required = True
      Size = 52
    end
    object IntegerField24: TIntegerField
      FieldName = 'KMPREVISTO'
    end
    object IntegerField25: TIntegerField
      FieldName = 'KM'
    end
    object FloatField13: TFloatField
      FieldName = 'VALORTOTAL'
      ReadOnly = True
      currency = True
    end
    object IntegerField26: TIntegerField
      FieldName = 'CODFATURA'
    end
    object DateField12: TDateField
      FieldName = 'DATAEMISSAO'
    end
    object FloatField14: TFloatField
      FieldName = 'VALOR'
      ReadOnly = True
      currency = True
    end
    object StringField37: TStringField
      FieldName = 'NOME'
      Required = True
      Size = 50
    end
    object StringField38: TStringField
      FieldName = 'ENDERECO'
      Size = 50
    end
    object StringField39: TStringField
      FieldName = 'CNPJ'
    end
    object StringField40: TStringField
      FieldName = 'IE'
    end
    object StringField41: TStringField
      FieldName = 'CIDADECLI'
      ReadOnly = True
      Required = True
      Size = 53
    end
    object StringField42: TStringField
      FieldName = 'OBS1'
      Size = 100
    end
    object DateField13: TDateField
      FieldName = 'DATAINICIO'
    end
    object DateField14: TDateField
      FieldName = 'DATAFIM'
    end
    object IntegerField27: TIntegerField
      FieldName = 'QUANTIDADE'
    end
    object FloatField15: TFloatField
      FieldName = 'PESO'
      DisplayFormat = '###,###,###'
      EditFormat = '###,###,###'
    end
    object SmallintField6: TSmallintField
      FieldName = 'TELEMONITORADO'
    end
    object FloatField16: TFloatField
      FieldName = 'DESCONTO'
      currency = True
    end
    object DateField15: TDateField
      FieldName = 'DATA'
    end
    object IntegerField28: TIntegerField
      FieldName = 'CODCLIENTE'
    end
    object DateTimeField7: TDateTimeField
      FieldName = 'PREVISAOSAIDA'
    end
    object DateTimeField8: TDateTimeField
      FieldName = 'PREVISAOCHEGADA'
    end
    object DateTimeField9: TDateTimeField
      FieldName = 'DATACHEGADA'
    end
    object StringField43: TStringField
      FieldName = 'NOMEMOT'
      Size = 50
    end
    object LargeintField2: TLargeintField
      FieldName = 'TEMPO'
      ReadOnly = True
    end
    object StringField44: TStringField
      FieldName = 'MCT'
      Size = 50
    end
    object QueryRFatura4HORA: TTimeField
      FieldName = 'HORA'
    end
    object QueryRFatura4origemdestino: TStringField
      DisplayWidth = 100
      FieldKind = fkCalculated
      FieldName = 'origemdestino'
      Size = 100
      Calculated = True
    end
  end
  object QueryRAnomaliaVeiculo: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      
        'select an.codanomalia, o.descricao, an.datastart, an.datastop, a' +
        'n.usuariostart,'
      
        'an.atitude,  v.placa, cidorigem.nome||'#39'-'#39'||cidorigem.uf as orige' +
        'm, ciddestino.nome||'#39'-'#39'||ciddestino.uf as destino'
      
        'from  ocorrencia o , anomalia an, comboio cb, cidade cidorigem, ' +
        'cidade ciddestino'
      'inner join veiculo v on (v.codveiculo = an.codveiculo)'
      'where (o.codocorrencia = an.codocorrencia)'
      'and ((an.anso = 0) or (an.anso is null))'
      'and cb.codorigem = cidorigem.codcidade'
      'and cb.coddestino =ciddestino.codcidade'
      'and cb.codcomboio = an.codcomboio')
    Params = <>
    Left = 520
    Top = 144
    object QueryRAnomaliaVeiculoCODANOMALIA: TIntegerField
      FieldName = 'CODANOMALIA'
      Required = True
    end
    object QueryRAnomaliaVeiculoDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 100
    end
    object QueryRAnomaliaVeiculoDATASTART: TDateTimeField
      FieldName = 'DATASTART'
    end
    object QueryRAnomaliaVeiculoDATASTOP: TDateTimeField
      FieldName = 'DATASTOP'
    end
    object QueryRAnomaliaVeiculoUSUARIOSTART: TStringField
      FieldName = 'USUARIOSTART'
      Size = 50
    end
    object QueryRAnomaliaVeiculoATITUDE: TStringField
      FieldName = 'ATITUDE'
      Size = 500
    end
    object QueryRAnomaliaVeiculoPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryRAnomaliaVeiculoORIGEM: TStringField
      FieldName = 'ORIGEM'
      ReadOnly = True
      Size = 53
    end
    object QueryRAnomaliaVeiculoDESTINO: TStringField
      FieldName = 'DESTINO'
      ReadOnly = True
      Size = 53
    end
  end
  object QueryREnvioNCVComboio: TZQuery
    Connection = DMprinc.ZConnection1
    SQL.Strings = (
      'select first 1'
      '     c2.NOME||'#39'-'#39'||c2.UF AS ORIGEM'
      '     , c3.NOME||'#39'-'#39'||c3.UF AS DESTINO'
      '     , CB.DATA'
      '     ,CLI.OBRVALORMERCADORIA'
      '     , CLI.OBRNUMEROCTRC'
      '     , CLI.OBRNOTAFISCAL'
      '     , CLI.OBRCONSULTAMOTORISTA'
      '     , m.nome'
      '     , v.placa'
      
        '     , cast((coalesce(cv.valornf, '#39'OBRG - Valor da Mercadoria'#39'))' +
        ' as varchar(30))  AS ValMercadoria'
      
        '     , cast((coalesce(cv.numeroctrc, '#39'OBRG - N'#250'mero do CTRC'#39'))as' +
        ' varchar(30)) AS ValCtrc'
      
        '     , cast((coalesce(cv.notafiscal, '#39'OBRG - Nota Fiscal'#39')) as v' +
        'archar(30)) AS ValNF'
      
        '     , cast((coalesce(cv.consultamotorista, '#39'OBRG - Consulta Mot' +
        'orista'#39'))as varchar(30))  AS ValConsMot'
      'from COMBOIO cb'
      '      inner join CIDADE c2 ON cb.CODORIGEM = c2.CODCIDADE'
      '      inner join CIDADE c3 ON cb.CODDESTINO = c3.CODCIDADE'
      '      INNER JOIN CLIENTE CLI ON (cli.codcliente = cb.codcliente)'
      
        '      inner join comboioveiculo cv on (cv.codcomboio = cb.codcom' +
        'boio)'
      
        '      inner join motorista m on (m.codmotorista = cv.codmotorist' +
        'a)'
      '      inner join veiculo v on (cv.codveiculo = v.codveiculo)'
      'where cb.CODCOMBOIO = :PCODCOMBOIO'
      
        'and ( CLI.OBRVALORMERCADORIA = -1 or CLI.OBRNUMEROCTRC = -1 or C' +
        'LI.OBRNOTAFISCAL = -1 or CLI.OBRCONSULTAMOTORISTA =-1)'
      '')
    Params = <
      item
        DataType = ftInteger
        Name = 'PCODCOMBOIO'
        ParamType = ptUnknown
      end>
    Left = 544
    Top = 424
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PCODCOMBOIO'
        ParamType = ptUnknown
      end>
    object QueryREnvioNCVComboioORIGEM: TStringField
      FieldName = 'ORIGEM'
      ReadOnly = True
      Size = 53
    end
    object QueryREnvioNCVComboioDESTINO: TStringField
      FieldName = 'DESTINO'
      ReadOnly = True
      Size = 53
    end
    object QueryREnvioNCVComboioDATA: TDateField
      FieldName = 'DATA'
    end
    object QueryREnvioNCVComboioOBRVALORMERCADORIA: TSmallintField
      FieldName = 'OBRVALORMERCADORIA'
    end
    object QueryREnvioNCVComboioOBRNUMEROCTRC: TSmallintField
      FieldName = 'OBRNUMEROCTRC'
    end
    object QueryREnvioNCVComboioOBRNOTAFISCAL: TSmallintField
      FieldName = 'OBRNOTAFISCAL'
    end
    object QueryREnvioNCVComboioOBRCONSULTAMOTORISTA: TSmallintField
      FieldName = 'OBRCONSULTAMOTORISTA'
    end
    object QueryREnvioNCVComboioNOME: TStringField
      FieldName = 'NOME'
      Size = 50
    end
    object QueryREnvioNCVComboioPLACA: TStringField
      FieldName = 'PLACA'
      Size = 8
    end
    object QueryREnvioNCVComboioVALMERCADORIA: TStringField
      FieldName = 'VALMERCADORIA'
      ReadOnly = True
      Size = 30
    end
    object QueryREnvioNCVComboioVALCTRC: TStringField
      FieldName = 'VALCTRC'
      ReadOnly = True
      Size = 30
    end
    object QueryREnvioNCVComboioVALNF: TStringField
      FieldName = 'VALNF'
      ReadOnly = True
      Size = 30
    end
    object QueryREnvioNCVComboioVALCONSMOT: TStringField
      FieldName = 'VALCONSMOT'
      ReadOnly = True
      Size = 30
    end
  end
end
